Bug 32764 - [4.3 regression] : Failed to bootstrap on Linux/ia64
Summary: [4.3 regression] : Failed to bootstrap on Linux/ia64
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2007-07-14 03:16 UTC by H.J. Lu
Modified: 2007-07-25 16:52 UTC (History)
7 users (show)

See Also:
Host:
Target: ia64-unknown-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-07-16 13:47:24


Attachments
_moddi3 source (20.90 KB, application/octet-stream)
2007-07-15 22:49 UTC, H.J. Lu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2007-07-14 03:16:07 UTC
This checkin:

http://gcc.gnu.org/ml/gcc-cvs/2007-07/msg00486.html

causes

/net/gnu-13/export/gnu/src/gcc/gcc/libgcc/../gcc/libgcc2.c: In function â__umodti3â:
/net/gnu-13/export/gnu/src/gcc/gcc/libgcc/../gcc/libgcc2.c:1137: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[5]: *** [_umoddi3.o] Error 1

var-tracking.c has

static rtx
find_src_set_src (dataflow_set *set, rtx loc, rtx insn)
{
  tree decl = NULL_TREE;   /* The variable being copied around.          */
  rtx src = NULL_RTX;      /* The location "decl" is being copied from.  */
  rtx set_src = NULL_RTX;  /* The value for "decl" stored in "src".      */
  void **slot;
  variable var;
  location_chain nextp;
  int i;
  bool found;

  if (GET_CODE (PATTERN (insn)) == SET)
    src = SET_SRC (PATTERN (insn));
  else if (GET_CODE (PATTERN (insn)) == PARALLEL
           || GET_CODE (PATTERN (insn)) == SEQUENCE)
    {
      for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
        if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET
            && SET_DEST (XVECEXP (PATTERN (insn), 0, i)) == loc)
          src = SET_SRC (XVECEXP (PATTERN (insn), 0, i));
    }

  if (REG_P (src))
    decl = var_debug_decl (REG_EXPR (src));
  else if (MEM_P (src))
    decl = var_debug_decl (MEM_EXPR (src));

That can't be right since src can be NULL and "if (REG_P (src))" will
segfault. insn is

(gdb) call debug_rtx (insn)
(insn 535 895 533 50 /net/gnu-13/export/gnu/src/gcc/gcc/libgcc/../gcc/libgcc2.c:1056 (cond_exec (eq (reg:BI 262 p6 [704])
            (const_int 0 [0x0]))
        (set (reg/v:DI 8 r8 [orig:386 m0.152 ] [386])
            (reg/v:DI 15 r15 [orig:455 m0 ] [455]))) 783 {sync_lock_releasedi+5} (nil))
Comment 1 H.J. Lu 2007-07-14 03:19:37 UTC
I am testing

--- gcc/var-tracking.c.bad      2007-07-13 19:38:08.000000000 -0700
+++ gcc/var-tracking.c  2007-07-13 20:18:19.000000000 -0700
@@ -1862,6 +1862,9 @@ find_src_set_src (dataflow_set *set, rtx
          src = SET_SRC (XVECEXP (PATTERN (insn), 0, i));
     }

+  if (!src)
+    return set_src;
+
   if (REG_P (src))
     decl = var_debug_decl (REG_EXPR (src));
   else if (MEM_P (src))
Comment 2 H.J. Lu 2007-07-14 03:25:54 UTC
This one

--- gcc/var-tracking.c.bad      2007-07-13 19:38:08.000000000 -0700
+++ gcc/var-tracking.c  2007-07-13 20:24:27.000000000 -0700
@@ -1824,6 +1824,9 @@ find_src_status (dataflow_set *in, rtx l
          src = SET_SRC (XVECEXP (PATTERN (insn), 0, i));
     }

+  if (!src)
+    return status;
+
   if (REG_P (src))
     decl = var_debug_decl (REG_EXPR (src));
   else if (MEM_P (src))
@@ -1862,6 +1865,9 @@ find_src_set_src (dataflow_set *set, rtx
          src = SET_SRC (XVECEXP (PATTERN (insn), 0, i));
     }

+  if (!src)
+    return set_src;
+
   if (REG_P (src))
     decl = var_debug_decl (REG_EXPR (src));
   else if (MEM_P (src))

passes the stage 1.
Comment 3 H.J. Lu 2007-07-14 04:57:22 UTC
(In reply to comment #2)
> This one
> 
> --- gcc/var-tracking.c.bad      2007-07-13 19:38:08.000000000 -0700
> +++ gcc/var-tracking.c  2007-07-13 20:24:27.000000000 -0700
> @@ -1824,6 +1824,9 @@ find_src_status (dataflow_set *in, rtx l
>           src = SET_SRC (XVECEXP (PATTERN (insn), 0, i));
>      }
> 
> +  if (!src)
> +    return status;
> +
>    if (REG_P (src))
>      decl = var_debug_decl (REG_EXPR (src));
>    else if (MEM_P (src))
> @@ -1862,6 +1865,9 @@ find_src_set_src (dataflow_set *set, rtx
>           src = SET_SRC (XVECEXP (PATTERN (insn), 0, i));
>      }
> 
> +  if (!src)
> +    return set_src;
> +
>    if (REG_P (src))
>      decl = var_debug_decl (REG_EXPR (src));
>    else if (MEM_P (src))
> 
> passes the stage 1.
> 

It works for me on Linux/ia32, Linux/Intel64 and Linux/ia64.
Comment 4 Andrew Pinski 2007-07-15 21:08:15 UTC
PS Where is the preprocessed source?
Comment 5 H.J. Lu 2007-07-15 22:49:59 UTC
Created attachment 13916 [details]
_moddi3 source

#  ./xgcc -B./ -O -g _moddi3.i -S
/net/gnu-13/export/gnu/src/gcc/gcc/libgcc/../gcc/libgcc2.c: In function ‘__modti3’:
/net/gnu-13/export/gnu/src/gcc/gcc/libgcc/../gcc/libgcc2.c:1125: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 6 Richard Biener 2007-07-16 13:47:24 UTC
Confirmed.
Comment 7 Steve Ellcey 2007-07-25 16:52:33 UTC
Carolyn has checked in a patch to var-tracking.c and I can bootstrap IA64 Linux so I am going to close this out as fixed.  The patch that fixed this was:

2007-07-18  Caroline Tice  <ctice@apple.com>

        * var-tracking.c (find_src_status):  Check for  COND_EXEC insns
        and handle them correctly; check that src is not NULL before
        trying to use it.
        (find_src_set_src): Likewise.