Commit 32818c2e authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: Fix issue with gcc 4.0 compiled kernels

I recently had a BUG_ON() go off spuriously on a gcc 4.0 compiled kernel.
It turns out gcc-4.0 was removing a sign extension while earlier gcc
versions would not.  Thinking this to be a compiler bug, I submitted a
report:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23422

It turns out we need to cast the input in order to tell gcc to sign extend
it.

Thanks to Andrew Pinski for his help on this bug.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 212d6d22
...@@ -43,8 +43,8 @@ struct bug_entry *find_bug(unsigned long bugaddr); ...@@ -43,8 +43,8 @@ struct bug_entry *find_bug(unsigned long bugaddr);
".section __bug_table,\"a\"\n\t" \ ".section __bug_table,\"a\"\n\t" \
" .llong 1b,%1,%2,%3\n" \ " .llong 1b,%1,%2,%3\n" \
".previous" \ ".previous" \
: : "r" (x), "i" (__LINE__), "i" (__FILE__), \ : : "r" ((long long)(x)), "i" (__LINE__), \
"i" (__FUNCTION__)); \ "i" (__FILE__), "i" (__FUNCTION__)); \
} while (0) } while (0)
#define WARN_ON(x) do { \ #define WARN_ON(x) do { \
...@@ -53,7 +53,8 @@ struct bug_entry *find_bug(unsigned long bugaddr); ...@@ -53,7 +53,8 @@ struct bug_entry *find_bug(unsigned long bugaddr);
".section __bug_table,\"a\"\n\t" \ ".section __bug_table,\"a\"\n\t" \
" .llong 1b,%1,%2,%3\n" \ " .llong 1b,%1,%2,%3\n" \
".previous" \ ".previous" \
: : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP), \ : : "r" ((long long)(x)), \
"i" (__LINE__ + BUG_WARNING_TRAP), \
"i" (__FILE__), "i" (__FUNCTION__)); \ "i" (__FILE__), "i" (__FUNCTION__)); \
} while (0) } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment