Created attachment 28110 [details] automatically reduced testcase When I compile the attached C++ code with GCC 4.7 and GNU as 2.22 with -O1, I get the following message: $ g++ -O1 -c reversebits.ii /tmp/cchfvrG0.s: Assembler messages: /tmp/cchfvrG0.s:40: Warning: 700415 shortened to 255 I do not think it is normal that GCC does not report any problem while the assembler does. The attached testcase was unfortunately automatically reduced from a large code base, so it isn't very readable. Sorry about that. I also do not know what is the right component, so putting in 'other' for now.
Started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179556 Looking into it.
Created attachment 28112 [details] gcc48-pr54436.patch Untested fix.
While a warning is emitted, is the code in the end still valid or is that a miscompilation?
Author: jakub Date: Sat Sep 1 19:09:02 2012 New Revision: 190849 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190849 Log: PR target/54436 * config/i386/i386.md (*mov<mode>_insv_1_rex64, *movsi_insv_1): If operands[1] is CONST_INT_P, convert it to QImode before printing. * gcc.dg/torture/pr54436.c: New test. Added: trunk/gcc/testsuite/gcc.dg/torture/pr54436.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.md trunk/gcc/testsuite/ChangeLog
Author: jakub Date: Mon Sep 3 16:05:44 2012 New Revision: 190900 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190900 Log: Backported from mainline 2012-09-01 Jakub Jelinek <jakub@redhat.com> PR target/54436 * config/i386/i386.md (*mov<mode>_insv_1_rex64, *movsi_insv_1): If operands[1] is CONST_INT_P, convert it to QImode before printing. * gcc.dg/torture/pr54436.c: New test. Added: branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr54436.c Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/config/i386/i386.md branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Fixed. Without the fix you get the assembler warning, but that should be harmless, as the assembler should truncate the value to the 8-bit value anyway, what the compiler does with the fix previously did the assembler after issuing the warning.