Bug 54436 - [4.7/4.8 Regression] Compiling some regular C++ code gives assembler '700415 shortened to 255' warning
Summary: [4.7/4.8 Regression] Compiling some regular C++ code gives assembler '700415 ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.1
: P3 normal
Target Milestone: 4.7.2
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-31 12:09 UTC by Mathias Gaunard
Modified: 2012-09-03 16:09 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-08-31 00:00:00


Attachments
automatically reduced testcase (6.73 KB, application/octet-stream)
2012-08-31 12:09 UTC, Mathias Gaunard
Details
gcc48-pr54436.patch (902 bytes, patch)
2012-08-31 16:42 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias Gaunard 2012-08-31 12:09:11 UTC
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.
Comment 1 Jakub Jelinek 2012-08-31 12:42:37 UTC
Started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179556
Looking into it.
Comment 2 Jakub Jelinek 2012-08-31 16:42:17 UTC
Created attachment 28112 [details]
gcc48-pr54436.patch

Untested fix.
Comment 3 Mathias Gaunard 2012-09-01 01:23:04 UTC
While a warning is emitted, is the code in the end still valid or is that a miscompilation?
Comment 4 Jakub Jelinek 2012-09-01 19:09:05 UTC
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
Comment 5 Jakub Jelinek 2012-09-03 16:05:50 UTC
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
Comment 6 Jakub Jelinek 2012-09-03 16:09:10 UTC
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.