Skip to content

Commit 32818c2

Browse files
antonblanchardLinus Torvalds
authored andcommitted
[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: Anton Blanchard <anton@samba.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 212d6d2 commit 32818c2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

include/asm-ppc64/bug.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ struct bug_entry *find_bug(unsigned long bugaddr);
4343
".section __bug_table,\"a\"\n\t" \
4444
" .llong 1b,%1,%2,%3\n" \
4545
".previous" \
46-
: : "r" (x), "i" (__LINE__), "i" (__FILE__), \
47-
"i" (__FUNCTION__)); \
46+
: : "r" ((long long)(x)), "i" (__LINE__), \
47+
"i" (__FILE__), "i" (__FUNCTION__)); \
4848
} while (0)
4949

5050
#define WARN_ON(x) do { \
@@ -53,7 +53,8 @@ struct bug_entry *find_bug(unsigned long bugaddr);
5353
".section __bug_table,\"a\"\n\t" \
5454
" .llong 1b,%1,%2,%3\n" \
5555
".previous" \
56-
: : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP), \
56+
: : "r" ((long long)(x)), \
57+
"i" (__LINE__ + BUG_WARNING_TRAP), \
5758
"i" (__FILE__), "i" (__FUNCTION__)); \
5859
} while (0)
5960

0 commit comments

Comments
 (0)