From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: linux-sparse@vger.kernel.org
Cc: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
"Pekka Enberg" <penberg@kernel.org>,
"Christopher Li" <sparse@chrisli.org>,
"Jeff Garzik" <jgarzik@redhat.com>,
"Linus Torvalds" <torvalds@linux-foundation.org>
Subject: [PATCH 2/2] sparse, llvm: Fix type of loaded values
Date: Wed, 10 Oct 2012 01:34:36 +0200 [thread overview]
Message-ID: <1349825676-1713-2-git-send-email-j.neuschaefer@gmx.net> (raw)
In-Reply-To: <1349825676-1713-1-git-send-email-j.neuschaefer@gmx.net>
Instead of making the computed address a pointer to an int type
large enough to hold a pointer, make it a pointer to the memory
object being loaded. This fixes another LLVM warning.
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Christopher Li <sparse@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
sparse-llvm.c | 2 +-
validation/backend/load-type.c | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 validation/backend/load-type.c
diff --git a/sparse-llvm.c b/sparse-llvm.c
index 2048a1b..7f45dc0 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -615,7 +615,7 @@ static void output_op_load(struct function *fn, struct instruction *insn)
/* convert address back to pointer */
addr = LLVMBuildIntToPtr(fn->builder, addr_i,
- LLVMPointerType(int_type, 0), "addr");
+ LLVMTypeOf(src_p), "addr");
/* perform load */
target = LLVMBuildLoad(fn->builder, addr, "load_target");
diff --git a/validation/backend/load-type.c b/validation/backend/load-type.c
new file mode 100644
index 0000000..80416ca
--- /dev/null
+++ b/validation/backend/load-type.c
@@ -0,0 +1,12 @@
+extern struct _IO_FILE *stdin;
+
+static void sub(struct _IO_FILE *in) {}
+
+static void test(void) {
+ sub(stdin);
+}
+
+/*
+ * check-name: Type of loaded objects
+ * check-command: ./sparsec -c $file -o tmp.o
+ */
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-10-09 23:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-09 23:34 [PATCH 1/2] sparse, llvm: group PHI nodes at the top of each BB Jonathan Neuschäfer
2012-10-09 23:34 ` Jonathan Neuschäfer [this message]
2012-10-10 0:13 ` [PATCH 2/2] sparse, llvm: Fix type of loaded values Jeff Garzik
2012-10-10 6:34 ` Pekka Enberg
2012-10-10 0:12 ` [PATCH 1/2] sparse, llvm: group PHI nodes at the top of each BB Jeff Garzik
2012-10-10 6:31 ` Pekka Enberg
2012-10-10 16:33 ` Jonathan Neuschäfer
2012-10-12 18:25 ` Pekka Enberg
2012-10-16 17:59 ` Pekka Enberg
2012-10-16 20:14 ` Jonathan Neuschäfer
2012-10-16 20:53 ` Xi Wang
2012-10-17 6:48 ` Pekka Enberg
2012-10-17 6:53 ` Xi Wang
2012-10-17 16:41 ` Pekka Enberg
2012-10-17 17:44 ` Jonathan Neuschäfer
2013-05-15 12:05 ` Pekka Enberg
2013-05-16 5:28 ` Xi Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349825676-1713-2-git-send-email-j.neuschaefer@gmx.net \
--to=j.neuschaefer@gmx.net \
--cc=jgarzik@redhat.com \
--cc=linux-sparse@vger.kernel.org \
--cc=penberg@kernel.org \
--cc=sparse@chrisli.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).