public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327
@ 2012-07-20 1:57 ksop at hot dot ee
2012-07-20 1:59 ` [Bug middle-end/54041] " ksop at hot dot ee
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: ksop at hot dot ee @ 2012-07-20 1:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
Bug #: 54041
Summary: -mshort ICE in convert_memory_address_addr_space, at
explow.c:327
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ksop@hot.ee
Appears when pointer+index is evaluated, with sizetype being short.
Also tried with one convert_memory_address_addr_space() call commented out, in
which case no ICE is produced. 4.6.3, 4.5.4 affected as well. An -mshort target
makes an interesting testing tool.
$ m68k-linux-gnu-gcc-4.7.1 -v
Using built-in specs.
COLLECT_GCC=m68k-linux-gnu-gcc-4.7.1
COLLECT_LTO_WRAPPER=/opt/gnu/libexec/gcc/m68k-linux-gnu/4.7.1/lto-wrapper
Target: m68k-linux-gnu
Configured with: ./configure --target=m68k-linux-gnu --build=x86_64-linux-gnu
--enable-languages=c --prefix=/opt/gnu
Thread model: posix
gcc version 4.7.1 (GCC)
$ m68k-linux-gnu-gcc-4.7.1 -mshort -O -S test.i
test.i: In function 'fn':
test.i:5:2: internal compiler error: in convert_memory_address_addr_space, at
explow.c:327
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
@ 2012-07-20 1:59 ` ksop at hot dot ee
2012-07-20 2:01 ` ksop at hot dot ee
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: ksop at hot dot ee @ 2012-07-20 1:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
--- Comment #1 from Kalev Soikonen <ksop at hot dot ee> 2012-07-20 01:59:05 UTC ---
Created attachment 27840
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27840
testcase
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
2012-07-20 1:59 ` [Bug middle-end/54041] " ksop at hot dot ee
@ 2012-07-20 2:01 ` ksop at hot dot ee
2012-07-20 10:22 ` mikpe at it dot uu.se
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: ksop at hot dot ee @ 2012-07-20 2:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
--- Comment #2 from Kalev Soikonen <ksop at hot dot ee> 2012-07-20 02:01:21 UTC ---
Created attachment 27841
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27841
melts the ICE
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
2012-07-20 1:59 ` [Bug middle-end/54041] " ksop at hot dot ee
2012-07-20 2:01 ` ksop at hot dot ee
@ 2012-07-20 10:22 ` mikpe at it dot uu.se
2012-07-20 10:54 ` schwab@linux-m68k.org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mikpe at it dot uu.se @ 2012-07-20 10:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
Mikael Pettersson <mikpe at it dot uu.se> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpe at it dot uu.se
--- Comment #3 from Mikael Pettersson <mikpe at it dot uu.se> 2012-07-20 10:22:03 UTC ---
Was this originally seen with an out-of-tree port?
m68k-linux-gcc -mshort is an unusual combination, and I would expect it to be
essentially unsupported as -mshort changes the ABI. For m68k-elf the option
might make sense, but I wasn't able to reproduce the ICE for m68k-elf, only
m68k-linux.
The ICE comes from explow.c:
rtx
convert_memory_address_addr_space (enum machine_mode to_mode ATTRIBUTE_UNUSED,
rtx x, addr_space_t as ATTRIBUTE_UNUSED)
{
#ifndef POINTERS_EXTEND_UNSIGNED
gcc_assert (GET_MODE (x) == to_mode || GET_MODE (x) == VOIDmode);
return x;
#else /* defined(POINTERS_EXTEND_UNSIGNED) */
m68k doesn't define P_E_U, but with -mshort to_mode apparently ends up being
shorter, so the above assertion fails.
The documentation for P_E_U states:
"
You need not define this macro if the @code{ptr_mode}, @code{Pmode}
and @code{word_mode} are all the same width.
"
-mshort changes word_mode, invalidating the condition for not defining P_E_U.
In this case a truncation is asked for. convert_memory_address_addr_space does
perform truncations, but only when P_E_U is defined. Defining P_E_U to 0
around c_m_a_a_s eliminated the ICE and generated reasonable-looking code.
I'm not sure if the bug is that the m68k backend doesn't define P_E_U even
though is permits -mshort, or that c_m_a_a_s is wrong and should perform
truncations also when P_E_U is undefined.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
` (2 preceding siblings ...)
2012-07-20 10:22 ` mikpe at it dot uu.se
@ 2012-07-20 10:54 ` schwab@linux-m68k.org
2012-07-20 11:33 ` mikpe at it dot uu.se
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: schwab@linux-m68k.org @ 2012-07-20 10:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> 2012-07-20 10:54:41 UTC ---
-mshort doesn't change word_mode, UNITS_PER_WORD is fixed at 4. -mshort only
changes sizeof(int).
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
` (3 preceding siblings ...)
2012-07-20 10:54 ` schwab@linux-m68k.org
@ 2012-07-20 11:33 ` mikpe at it dot uu.se
2012-07-20 12:37 ` schwab@linux-m68k.org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mikpe at it dot uu.se @ 2012-07-20 11:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
--- Comment #5 from Mikael Pettersson <mikpe at it dot uu.se> 2012-07-20 11:33:14 UTC ---
Ok, in that case I'd say the m68k backend is entitled to not define P_E_U, and
it's really c_m_a_a_s (or something related to it) that's broken.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
` (4 preceding siblings ...)
2012-07-20 11:33 ` mikpe at it dot uu.se
@ 2012-07-20 12:37 ` schwab@linux-m68k.org
2012-07-20 13:15 ` [Bug middle-end/54041] [4.7/4.8 regression] " schwab@linux-m68k.org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: schwab@linux-m68k.org @ 2012-07-20 12:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
--- Comment #6 from Andreas Schwab <schwab@linux-m68k.org> 2012-07-20 12:37:41 UTC ---
expr.c:7576: tmp = convert_memory_address_addr_space (tmode, tmp, as);
This looks bogus, tmp (which is the expanded offset) isn't a memory address.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] [4.7/4.8 regression] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
` (5 preceding siblings ...)
2012-07-20 12:37 ` schwab@linux-m68k.org
@ 2012-07-20 13:15 ` schwab@linux-m68k.org
2012-07-20 13:18 ` schwab@linux-m68k.org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: schwab@linux-m68k.org @ 2012-07-20 13:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-07-20
Known to work| |4.6.4
Summary|-mshort ICE in |[4.7/4.8 regression]
|convert_memory_address_addr |-mshort ICE in
|_space, at explow.c:327 |convert_memory_address_addr
| |_space, at explow.c:327
Ever Confirmed|0 |1
Known to fail| |4.7.1
--- Comment #7 from Andreas Schwab <schwab@linux-m68k.org> 2012-07-20 13:15:43 UTC ---
Before 4.7 the array reference was expanded to (int *) &r + (unsigned int)
((unsigned int) i * 2), now it is preserved as &r[i], causing the ADDR_EXPR to
contain ARRAY_REF of (r,i) where it previously contained r only.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] [4.7/4.8 regression] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
` (6 preceding siblings ...)
2012-07-20 13:15 ` [Bug middle-end/54041] [4.7/4.8 regression] " schwab@linux-m68k.org
@ 2012-07-20 13:18 ` schwab@linux-m68k.org
2012-09-07 10:02 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: schwab@linux-m68k.org @ 2012-07-20 13:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.7.2
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] [4.7/4.8 regression] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
` (7 preceding siblings ...)
2012-07-20 13:18 ` schwab@linux-m68k.org
@ 2012-09-07 10:02 ` rguenth at gcc dot gnu.org
2012-09-20 10:28 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-07 10:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |m68k-linux-gnu
Priority|P3 |P4
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] [4.7/4.8 regression] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
` (8 preceding siblings ...)
2012-09-07 10:02 ` rguenth at gcc dot gnu.org
@ 2012-09-20 10:28 ` jakub at gcc dot gnu.org
2013-04-11 8:00 ` [Bug middle-end/54041] [4.7/4.8/4.9 " rguenth at gcc dot gnu.org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-09-20 10:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.7.2 |4.7.3
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-09-20 10:19:39 UTC ---
GCC 4.7.2 has been released.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] [4.7/4.8/4.9 regression] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
` (9 preceding siblings ...)
2012-09-20 10:28 ` jakub at gcc dot gnu.org
@ 2013-04-11 8:00 ` rguenth at gcc dot gnu.org
2014-02-06 6:02 ` law at redhat dot com
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-11 8:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.7.3 |4.7.4
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-11 07:59:26 UTC ---
GCC 4.7.3 is being released, adjusting target milestone.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] [4.7/4.8/4.9 regression] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
` (10 preceding siblings ...)
2013-04-11 8:00 ` [Bug middle-end/54041] [4.7/4.8/4.9 " rguenth at gcc dot gnu.org
@ 2014-02-06 6:02 ` law at redhat dot com
2014-02-11 13:59 ` law at gcc dot gnu.org
2014-02-11 14:00 ` law at redhat dot com
13 siblings, 0 replies; 15+ messages in thread
From: law at redhat dot com @ 2014-02-06 6:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
Jeffrey A. Law <law at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P4 |P5
CC| |law at redhat dot com
Assignee|unassigned at gcc dot gnu.org |law at redhat dot com
--- Comment #10 from Jeffrey A. Law <law at redhat dot com> ---
I believe the problem is expand_expr_addr_expr_1 assumes that expand_expr will
produce a result in the requested mode. Unfortunately, expand_expr has always
been free to return an object with a different mode.
If we use convert_modes in the obvious way when tmode != GET_MODE (tmp) we no
longer get the ICE and the resulting code looks reasonably correct.
Of course we don't really have a good way to test -mshort. I'm not even sure
if it's used anymore in real world scenarios.
I'll do a bootstrap and test on x86_64, but I obviously realize that's not
going to give this change any real coverage testing.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] [4.7/4.8/4.9 regression] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
` (11 preceding siblings ...)
2014-02-06 6:02 ` law at redhat dot com
@ 2014-02-11 13:59 ` law at gcc dot gnu.org
2014-02-11 14:00 ` law at redhat dot com
13 siblings, 0 replies; 15+ messages in thread
From: law at gcc dot gnu.org @ 2014-02-11 13:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
--- Comment #11 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Author: law
Date: Tue Feb 11 13:58:46 2014
New Revision: 207689
URL: http://gcc.gnu.org/viewcvs?rev=207689&root=gcc&view=rev
Log:
PR middle-end/54041
* expr.c (expand_expr_addr_expr_1): Handle expand_expr returning an
object with an undesirable mode.
PR middle-end/54041
* gcc.target/m68k/pr54041.c: New test.
Added:
trunk/gcc/testsuite/gcc.target/m68k/pr54041.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/expr.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/54041] [4.7/4.8/4.9 regression] -mshort ICE in convert_memory_address_addr_space, at explow.c:327
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
` (12 preceding siblings ...)
2014-02-11 13:59 ` law at gcc dot gnu.org
@ 2014-02-11 14:00 ` law at redhat dot com
13 siblings, 0 replies; 15+ messages in thread
From: law at redhat dot com @ 2014-02-11 14:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041
Jeffrey A. Law <law at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #12 from Jeffrey A. Law <law at redhat dot com> ---
Fixed on trunk. No plans to backport fix to release branches.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2014-02-11 14:00 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-20 1:57 [Bug middle-end/54041] New: -mshort ICE in convert_memory_address_addr_space, at explow.c:327 ksop at hot dot ee
2012-07-20 1:59 ` [Bug middle-end/54041] " ksop at hot dot ee
2012-07-20 2:01 ` ksop at hot dot ee
2012-07-20 10:22 ` mikpe at it dot uu.se
2012-07-20 10:54 ` schwab@linux-m68k.org
2012-07-20 11:33 ` mikpe at it dot uu.se
2012-07-20 12:37 ` schwab@linux-m68k.org
2012-07-20 13:15 ` [Bug middle-end/54041] [4.7/4.8 regression] " schwab@linux-m68k.org
2012-07-20 13:18 ` schwab@linux-m68k.org
2012-09-07 10:02 ` rguenth at gcc dot gnu.org
2012-09-20 10:28 ` jakub at gcc dot gnu.org
2013-04-11 8:00 ` [Bug middle-end/54041] [4.7/4.8/4.9 " rguenth at gcc dot gnu.org
2014-02-06 6:02 ` law at redhat dot com
2014-02-11 13:59 ` law at gcc dot gnu.org
2014-02-11 14:00 ` law at redhat dot com
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 read-only IMAP folder(s) and NNTP newsgroup(s).