public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: middle-end/10475: [3.2/3.3/3.4 regression] ICE in subreg_highpart_offset for code with long long
@ 2003-05-21 16:07 Arend Bayer
  0 siblings, 0 replies; 2+ messages in thread
From: Arend Bayer @ 2003-05-21 16:07 UTC (permalink / raw)
  To: gcc-prs, mh37, gcc-bugs, gcc-gnats, nobody


http://gcc.gnu.org/PR10475

This happens when emit_store_flag() gets passed two long integers, the
2nd being 0 and the code being EQ or NE.

This call

/* If we are comparing a double-word integer with zero, we can convert
     the comparison into one involving a single word.  */
  if (GET_MODE_BITSIZE (mode) == BITS_PER_WORD * 2
      && GET_MODE_CLASS (mode) == MODE_INT
      && op1 == const0_rtx
      && (GET_CODE (op0) != MEM || ! MEM_VOLATILE_P (op0)))
    {
      if (code == EQ || code == NE)
        {
          /* Do a logical OR of the two words and compare the result.  * */
          rtx op0h = gen_highpart (word_mode, op0);
          rtx op0l = gen_lowpart (word_mode, op0);

to gen_highpart silently assumes that GET_MODE (op0) == mode. But
if op0 is CONST_INT, it has VOIDmode, of course.

The patch (against HEAD on 2003-05-21) below makes the ICE go away, but of
course one might want to do s.th. more intelligent with a comparison of
two integer constants...

(And another solution would of course be to teach gen_highpart () to
handle integer constants.)

Arend


Index: gcc/expmed.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.133
diff -u -p -r1.133 expmed.c
--- gcc/expmed.c	21 Apr 2003 21:32:00 -0000	1.133
+++ gcc/expmed.c	21 May 2003 14:17:20 -0000
@@ -4350,7 +4350,8 @@ emit_store_flag (target, code, op0, op1,
   if (GET_MODE_BITSIZE (mode) == BITS_PER_WORD * 2
       && GET_MODE_CLASS (mode) == MODE_INT
       && op1 == const0_rtx
-      && (GET_CODE (op0) != MEM || ! MEM_VOLATILE_P (op0)))
+      && (GET_CODE (op0) != MEM || ! MEM_VOLATILE_P (op0))
+      && GET_CODE (op0) != CONST_INT)
     {
       if (code == EQ || code == NE)
 	{



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: middle-end/10475: [3.2/3.3/3.4 regression] ICE in subreg_highpart_offset for code with long long
@ 2003-04-24 13:47 bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-04-24 13:47 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, mh37, nobody

Old Synopsis: internal error with built in expect
New Synopsis: [3.2/3.3/3.4 regression] ICE in subreg_highpart_offset for code with long long

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Thu Apr 24 13:19:33 2003
State-Changed-Why:
    Confirmed. Has nothing to do with builtin_expect, though:
    ---------------------------
    static inline
    void foo(long long const v0,
             long long const v1) 
    {
        bar(v0 == v1);
    }
    
    void test(void) {
        foo(0,1);
    }
    -------------------------
    
    This ICEs with 3.2, 3.3 and 3.4, but not with 3.0, so is
    a regression:
    
    g/x> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -c x.i -O2
    x.i: In function `test':
    x.i:5: internal compiler error: in subreg_highpart_offset, at emit-rtl.c:1486
    Please submit a full bug report,
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10475


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-21 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-21 16:07 middle-end/10475: [3.2/3.3/3.4 regression] ICE in subreg_highpart_offset for code with long long Arend Bayer
  -- strict thread matches above, loose matches on Subject: below --
2003-04-24 13:47 bangerth

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).