User account creation filtered due to spam.

Bug 34525 - [4.3 Regression] ICE in extract_insn, at recog.c:1990 on hppa
Summary: [4.3 Regression] ICE in extract_insn, at recog.c:1990 on hppa
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-18 20:14 UTC by Martin Michlmayr
Modified: 2007-12-21 23:58 UTC (History)
2 users (show)

See Also:
Host:
Target: hppa-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
preprocessed source (8.73 KB, application/octet-stream)
2007-12-18 20:15 UTC, Martin Michlmayr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2007-12-18 20:14:44 UTC
With 4.3.0 20071212 on hppa:

tbm@tx:~$  /usr/lib/gcc-snapshot/bin/gcc -O1 -fPIC ffcall-trampoline.i
./trampoline.c: In function 'is_trampoline_r':
./trampoline.c:1176: error: unrecognizable insn:
(insn 10 9 11 4 ./trampoline.c:1168 (set (reg:SI 100)
        (plus:SI (reg:SI 19 %r19)
            (high:SI (symbol_ref/v:SI ("@tramp_r") [flags 0x41] <function_decl 0x4007bb60 tramp_r>)))) -1 (nil))
./trampoline.c:1176: internal compiler error: in extract_insn, at recog.c:1990
Please submit a full bug report,
Comment 1 Martin Michlmayr 2007-12-18 20:15:07 UTC
Created attachment 14791 [details]
preprocessed source
Comment 2 John David Anglin 2007-12-20 01:18:11 UTC
Subject: Bug 34525

Author: danglin
Date: Thu Dec 20 01:17:57 2007
New Revision: 131096

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131096
Log:
	PR target/34525
	* pa.c (legitimize_pic_address): Force function labels into memory.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/pa/pa.c

Comment 3 John David Anglin 2007-12-20 01:42:55 UTC
Fixed by change.

What are the reasons this was marked as a 4.3 regression?  I'm interested
when the regression occurred since the backend has never forced function
labels to memory in this code.

A simpler testcase is:

dave@gsyprf11:~/gcc_test$ less pr34525.c
extern void tramp_r ();
int is_trampoline_r (void* function)
{
  void *tramp_r_address = &tramp_r;

  if (!(((long)function & 3) == 2))
    return 0;

  return
   ((((long *) ((char*)function - 2))[0] == ((long *) ((char*)tramp_r_address-2)
)[0])
    && ((((long *) ((char*)function - 2))[2]) == (long)((char*)function - 2 + 16
))
    ? 1 : 0
   );
}
Comment 4 Martin Michlmayr 2007-12-20 05:07:46 UTC
I marked it as a 4.3 regression because I believe 4.2 was able to compile
the code.  If you think it applies to 4.2, maybe it would be a good idea
to apply the patch there as well.

BTW, it might be a good idea to check in the testcase you came up with.

Thanks for fixing this so quickly.
Comment 5 dave 2007-12-20 14:45:08 UTC
Subject: Re:  [4.3 Regression] ICE in extract_insn, at recog.c:1990 on hppa

> Thanks for fixing this so quickly.

Actually, I realized last night that I failed to load the function label
from memory.  I'll try to fix it today.

I don't think I'll install the testcase.  The reason is there are
no complex circumstances around this change.  So, once the problem
is fixed, I expect it to stay fixed.

Dave
Comment 6 John David Anglin 2007-12-21 23:37:23 UTC
Subject: Bug 34525

Author: danglin
Date: Fri Dec 21 23:37:07 2007
New Revision: 131126

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131126
Log:
	PR target/34525
	* pa.c (legitimize_pic_address): Emit insn to load function label
	forced to memory.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/pa/pa.c

Comment 7 John David Anglin 2007-12-21 23:58:35 UTC
This problem should now be fixed.  I had modified the testcase and
this led me to think I'd killed the ICE ;)

I have to say that the code in the original testcase is probably very
wrong for hppa.  Like ia64, function pointers point to function descriptors
(when the plabel bit is set).  The function descriptor also may point to
a stub and not the function code.