Bug 10229

Summary: [3.3/3.4 regression] [IA-64 HP-UX 11.22] Internal compiler error in emit_move_insn
Product: gcc Reporter: gcc-bug
Component: bootstrapAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal CC: ahs3, francois-xavier.kowalski, gcc-bugs, sje
Priority: P3    
Version: 3.2.2   
Target Milestone: 3.3.1   
Host: ia64-hp-hpux11.22 Target: ia64-hp-hpux11.22
Build: ia64-hp-hpux11.22 Known to work:
Known to fail: Last reconfirmed:
Attachments: log.txt

Description gcc-bug 2003-03-26 19:36:00 UTC
This problem occurs building GCC 3.2.2.  After running "configure", then "gmake bootstrap", the build fails with:

../../gcc-3.2.2/gcc/config/ia64/unwind-ia64.c:259: Internal compiler error in emit_move_insn, at expr.c:2771

Release:
3.2.2

Environment:
HP-UX 11.22 with GCC 3.2 20020329 (experimental), GNU make 3.79.1, binutils 2.13.2.1
Comment 1 Dara Hazeghi 2003-05-07 10:05:50 UTC
From: Dara Hazeghi <dhazeghi@yahoo.com>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-bug@bullseye.com,
   nobody@gcc.gnu.org
Cc:  
Subject: Re: bootstrap/10229: [IA-64 HP-UX 11.22] Internal compiler error in emit_move_insn
Date: Wed, 7 May 2003 10:05:50 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- 
 trail&database=gcc&pr=10229
 
 Hello all,
 
 I can confirm this bug on gcc 3.2.3 compiler. Removing the flag -milp32  
 allows the testcase to compile successfully. Attached is a distilled  
 testcase from unwind-ia64.c which crashes the compilers (taken from a  
 cross build). With 3.3 cvs we crash at a different point, no matter  
 what flags are used, and with mainline at a still different point also  
 independent of flag. Yuck. Testcases follow.
 
 Dara
 
 3.2 crash.c
 xtern int __sync_val_compare_and_swap_si (int *, int, int);
 extern long __sync_val_compare_and_swap_di (long *, long, long);
 
 static __inline__ int
 atomic_alloc (unsigned int *mask)
 {
    unsigned int old = *mask, ret, new;
 
    while (1)
      {
        if (old == 0)
          return -1;
        ret = old & -old;
        new = old & ~ret;
        new = ((sizeof (*(mask)) == sizeof(int)) ? (__typeof__(*(mask)))  
 __sync_va
 l_compare_and_swap_si((int *)(mask),(int)(old),(int)(new)) :  
 (__typeof__(*(mask)
 )) __sync_val_compare_and_swap_di((long  
 *)(mask),(long)(old),(long)(new)));
        if (old == new)
          break;
        old = new;
      }
 
    return __builtin_ffs (ret) - 1;
 }
 
 crash.c: In function `atomic_alloc':
 crash.c:15: Internal compiler error in emit_move_insn, at expr.c:2771
 
 3.3 crash.c
 struct _Unwind_Context
 {
 
    unsigned long eh_data[4];
 
 };
 
 extern void uw_init_context_1();
 
 void
 _Unwind_RaiseException(void)
 {
    struct _Unwind_Context this_context;
 
 
    uw_init_context_1 (&this_context, __builtin_ia64_bsp ());
 
 }
 
 crash.c: In function `_Unwind_RaiseException':
 crash.ci:16: internal compiler error: in emit_move_insn, at expr.c:3144
 Please submit a full bug report,
 with preprocessed source if appropriate.
 
 3.4 crash.c:
 static int emergency_reg_state_free = 14;
 
 
 int alloc_reg_state (void)
 {
        int n = atomic_alloc (&emergency_reg_state_free);
 
 }
 
 crash.c:8: error: unrecognizable insn:
 (insn 38 29 9 0 0x1005300 (set (reg:SI 120 r36)
          (plus:DI (reg:DI 1 r1)
              (symbol_ref:SI ("emergency_reg_state_free") [flags 0x6]  
 <var_decl 0x1002e0c emergency_reg_state_free>))) -1 (nil)
      (nil))
 crash.c:8: internal compiler error: in extract_insn, at recog.c:2188
 
Comment 2 Wolfgang Bangerth 2003-05-07 21:13:44 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed by Dara
Comment 3 Dara Hazeghi 2003-06-02 19:47:29 UTC
Hello,

with gcc 3.3 branch and mainline (20030601), both the first and third testcases compile fine. The 
second however still fails in 32 bit mode, but compiles fine in 64 bit mode. Anyone have any ideas 
who I should contact about this? Thanks,

Dara
Comment 4 Dara Hazeghi 2003-06-08 04:08:06 UTC
Steve,

you seem to be the developer both most active and knowledgeable on IA64 ilp32 issues. Do you 
have any suggestions regarding the problem in this report? The failing testcase appears reasonably 
straightforward, and the problem only occurs in ilp32 mode. Thanks,

Dara

P.S. This is the testcase (just to make clear, as the trail for this bug has become a bit convoluted):

struct _Unwind_Context
 {
 
    unsigned long eh_data[4];
 
 };
 
 extern void uw_init_context_1();
 
 void
 _Unwind_RaiseException(void)
 {
    struct _Unwind_Context this_context;
 
 
    uw_init_context_1 (&this_context, __builtin_ia64_bsp ());
 
 }
Comment 5 Steve Ellcey 2003-06-09 22:24:55 UTC
Subject: Re:  [3.3/3.4 regression] [IA-64 HP-UX 11.22] Internal compiler error in emit_move_insn

There are two bugs here, one is that the test case you sent will not
compile, and this is because of the use of __builtin_ia64_bsp.  The
second bug is that a build/bootstrap of GCC should not be compiling
unwind-ia64.c.

In GCC 3.3, the issue of compiling unwind-ia64.c is fixed and
unwind-ia64.c is not compiled.  When I configure GCC for
ia64-hp-hpux11.22, I specify --enable-libunwind-exceptions to use the HP
unwind library when building the ia64-hp-hpux11.22 GCC.  The GCC unwind
part of libgcc (unwind-ia64.c) has never been properly ported to HP-UX
and probably wouldn't work even if it compiled.  With GCC 3.3 and later
it shouldn't try to compile it.

In terms of the small test case, the problem is that __builtin_ia64_bsp
doesn't work properly with ILP32 mode.  It could be fixed but the only
use of it is in the unwind library (which we don't use) so I am not too
excited about fixing it.  Note that fixing the bug in the test case
(making it compile) would not necessarily make the code in unwind-ia64.c
work, it would probably need more changes to work properly on HP-UX.

While working on the GCC port to HP-UX IA64 we made a decision to use
the HP-UX unwind library instead of porting the GCC one in order to
maximize the compatibility between the HP-UX compilers and GCC, that is
why we never dealt with this issue.

Also, I don't think GCC 3.2.2 works properly on ia64-hp-hpux11.22.  Most
of it is there, but it might have other problems.  I would use GCC 3.3
along with one patch I submitted after release, See
http://gcc.gnu.org/ml/gcc-patches/2003-05/msg01937.html for the patch I
submitted and checked in on the main line and on the GCC 3.3 branch.

Steve Ellcey
sje@cup.hp.com
Comment 6 Dara Hazeghi 2003-06-11 15:51:03 UTC
According to Steve, this testcase is effectively unsupported in ilp32 mode, hence this is not really a 
bug. Closing as INVALID... Original submitter should try gcc 3.3...
Comment 7 francois-xavier.kowalski 2003-06-13 13:03:01 UTC
*** Bug 11155 has been marked as a duplicate of this bug. ***
Comment 8 Dara Hazeghi 2003-06-20 23:35:16 UTC
*** Bug 8261 has been marked as a duplicate of this bug. ***