public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/60720] New: clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941
@ 2014-03-31 12:41 rguenth at gcc dot gnu.org
  2014-03-31 12:49 ` [Bug lto/60720] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-31 12:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60720

            Bug ID: 60720
           Summary: clisp fails to build with -flto: internal compiler
                    error: tree check: expected array_type, have
                    record_type in array_ref_low_bound, at expr.c:6941
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: lto
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org

Created attachment 32496
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32496&action=edit
testcase

compile with -flto:

> ./xgcc -B. regexi.m.i modules.i -flto 
modules.h:4:316: warning: type of 'module__regexp__object_tab_initdata' does
not match original declaration
/home/abuild/rpmbuild/BUILD/clisp-2.49/modules/regexp/regexi.c:59:3: note:
previously declared here
modules.h:4:254: warning: type of 'module__regexp__subr_tab_initdata' does not
match original declaration
/home/abuild/rpmbuild/BUILD/clisp-2.49/modules/regexp/regexi.c:173:3: note:
previously declared here
modules.h:4:154: warning: type of 'module__regexp__object_tab' does not match
original declaration
/home/abuild/rpmbuild/BUILD/clisp-2.49/modules/regexp/regexi.c:42:3: note:
previously declared here
modules.h:4:63: warning: type of 'module__regexp__subr_tab' does not match
original declaration
/home/abuild/rpmbuild/BUILD/clisp-2.49/modules/regexp/regexi.c:153:35: note:
previously declared here
lto1: internal compiler error: tree check: expected array_type, have
record_type in array_ref_low_bound, at expr.c:6941
0xd8ac7f tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /space/rguenther/src/svn/trunk/gcc/tree.c:9192
0x60b229 tree_check(tree_node*, char const*, int, char const*, tree_code)
        /space/rguenther/src/svn/trunk/gcc/tree.h:2713
0x79d6ae array_ref_low_bound(tree_node*)
        /space/rguenther/src/svn/trunk/gcc/expr.c:6941
0x79cf1e get_inner_reference(tree_node*, long*, long*, tree_node**,
machine_mode*, int*, int*, bool)
        /space/rguenther/src/svn/trunk/gcc/expr.c:6791
0x79fe95 expand_expr_addr_expr_1
        /space/rguenther/src/svn/trunk/gcc/expr.c:7689
0x7a0550 expand_expr_addr_expr
        /space/rguenther/src/svn/trunk/gcc/expr.c:7783
0x7ab686 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /space/rguenther/src/svn/trunk/gcc/expr.c:10562
0x7a09ce expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
        /space/rguenther/src/svn/trunk/gcc/expr.c:7950
0xdbe930 expand_expr
        /space/rguenther/src/svn/trunk/gcc/expr.h:457
0xdcbeb3 output_constant
        /space/rguenther/src/svn/trunk/gcc/varasm.c:4706
0xdccd4b output_constructor_regular_field
        /space/rguenther/src/svn/trunk/gcc/varasm.c:4952
0xdcd711 output_constructor
        /space/rguenther/src/svn/trunk/gcc/varasm.c:5231
0xdcc3fe output_constant
        /space/rguenther/src/svn/trunk/gcc/varasm.c:4756
0xdccd4b output_constructor_regular_field
        /space/rguenther/src/svn/trunk/gcc/varasm.c:4952
0xdcd711 output_constructor
        /space/rguenther/src/svn/trunk/gcc/varasm.c:5231
0xdcc0d5 output_constant
        /space/rguenther/src/svn/trunk/gcc/varasm.c:4728
0xdc3b00 assemble_variable_contents
        /space/rguenther/src/svn/trunk/gcc/varasm.c:1954
0xdc43e9 assemble_variable(tree_node*, int, int, int)
        /space/rguenther/src/svn/trunk/gcc/varasm.c:2139
0xdd5155 varpool_assemble_decl(varpool_node*)
        /space/rguenther/src/svn/trunk/gcc/varpool.c:455
0x6cb6fb output_in_order
        /space/rguenther/src/svn/trunk/gcc/cgraphunit.c:2010
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: ./xgcc returned 1 exit status
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
lto-wrapper failed
collect2: error: ld returned 1 exit status


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

* [Bug lto/60720] clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941
  2014-03-31 12:41 [Bug lto/60720] New: clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941 rguenth at gcc dot gnu.org
@ 2014-03-31 12:49 ` rguenth at gcc dot gnu.org
  2014-03-31 13:13 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-31 12:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60720

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-31
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's

 module_t modules[] = {
  { "clisp",
...
{ "regexp", &module__regexp__subr_tab.subrs[0], &module__regexp__subr_tab_size,
&module__regexp__object_tab[0], &module__regexp__object_tab_size, 0,
&module__regexp__subr_tab_initdata[0], &module__regexp__object_tab_initdata[0],
&module__regexp__init_function_1, &module__regexp__init_function_2,
&module__regexp__fini_function , ((void *)0) },
...

using &module__regexp__object_tab[0] (an array-ref), and declared as

extern gcv_object_t module__regexp__object_tab[];

but defined in the other module as

struct module__regexp__object_tab_t {
  gcv_object_t _object_Kboolean;
  gcv_object_t _object_Kend;
  gcv_object_t _object_Kextended;
  gcv_object_t _object_Kignore_case;
  gcv_object_t _object_Knewline;
  gcv_object_t _object_Knosub;
  gcv_object_t _object_Knotbol;
  gcv_object_t _object_Knoteol;
  gcv_object_t _object_Kreturn_type;
  gcv_object_t _object_Kstart;
  gcv_object_t _object_regexp__make_match_boa;
  gcv_object_t _object__23_28_29;
} module__regexp__object_tab;

thus no array for the actual decl.

Reduced testcase:

extern int x[];
int *foo[] = { &x[0] };

----

int x;


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

* [Bug lto/60720] clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941
  2014-03-31 12:41 [Bug lto/60720] New: clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941 rguenth at gcc dot gnu.org
  2014-03-31 12:49 ` [Bug lto/60720] " rguenth at gcc dot gnu.org
@ 2014-03-31 13:13 ` rguenth at gcc dot gnu.org
  2014-04-14  8:36 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-31 13:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60720

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
We miss to wrap uses of non-automatic vars inside MEM_REFs for global
initializers
(we do that for the IL already).

Doing this raises the question whether we shouldn't simply special-case
global var references and stream a type which each reference, materializing
a MEM_REF only when necessary (not sure if we know that at the point we are
materializing the initializer).

Anyway, short-term fix:

Index: gcc/lto-streamer-out.c
===================================================================
--- gcc/lto-streamer-out.c      (revision 208955)
+++ gcc/lto-streamer-out.c      (working copy)
@@ -313,6 +313,27 @@ lto_is_streamable (tree expr)
 }


+/* Wrap symbol references in *TP inside a type-preserving MEM_REF.  */
+
+static tree
+wrap_refs (tree *tp, int *ws, void *)
+{
+  tree t = *tp;
+  if (TREE_CODE (t) == VAR_DECL)
+    {
+      tree ptrtype = build_pointer_type (TREE_TYPE (t));
+      *tp = build2 (MEM_REF, TREE_TYPE (t),
+                   build1 (ADDR_EXPR, ptrtype, t),
+                   build_int_cst (ptrtype, 0));
+      *ws = 0;
+    }
+  else if (TREE_CODE (t) == CONSTRUCTOR)
+    ;
+  else if (!EXPR_P (t))
+    *ws = 0;
+  return NULL_TREE;
+}
+
 /* For EXPR lookup and return what we want to stream to OB as DECL_INITIAL. 
*/

 static tree
@@ -340,6 +361,14 @@ get_symbol_initial_value (struct output_
        initial = error_mark_node;
     }

+  /* Wrap all symbol references inside the initializer in a MEM_REF
+     to preserve the type at the use even in case the symbol is
+     prevailed by one with a different type.  We can safely skip this
+     during WPA.  */
+  if (!in_lto_p
+      && initial && initial != error_mark_node)
+    walk_tree (&initial, wrap_refs, NULL, NULL);
+
   return initial;
 }


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

* [Bug lto/60720] clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941
  2014-03-31 12:41 [Bug lto/60720] New: clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941 rguenth at gcc dot gnu.org
  2014-03-31 12:49 ` [Bug lto/60720] " rguenth at gcc dot gnu.org
  2014-03-31 13:13 ` rguenth at gcc dot gnu.org
@ 2014-04-14  8:36 ` rguenth at gcc dot gnu.org
  2014-04-14  8:40 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-14  8:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60720

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Mon Apr 14 08:35:22 2014
New Revision: 209359

URL: http://gcc.gnu.org/viewcvs?rev=209359&root=gcc&view=rev
Log:
2014-04-14  Richard Biener  <rguenther@suse.de>

    PR lto/60720
    * lto-streamer-out.c (wrap_refs): New function.
    (lto_output): Wrap symbol references in global initializes in
    type-preserving MEM_REFs.

    * gcc.dg/lto/pr60720_0.c: New testcase.
    * gcc.dg/lto/pr60720_1.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/lto/pr60720_0.c
    trunk/gcc/testsuite/gcc.dg/lto/pr60720_1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lto-streamer-out.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug lto/60720] clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941
  2014-03-31 12:41 [Bug lto/60720] New: clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941 rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-04-14  8:36 ` rguenth at gcc dot gnu.org
@ 2014-04-14  8:40 ` rguenth at gcc dot gnu.org
  2014-04-23  8:32 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-14  8:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60720

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
      Known to work|                            |4.10.0
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
      Known to fail|                            |4.9.0

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.


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

* [Bug lto/60720] clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941
  2014-03-31 12:41 [Bug lto/60720] New: clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941 rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-04-14  8:40 ` rguenth at gcc dot gnu.org
@ 2014-04-23  8:32 ` rguenth at gcc dot gnu.org
  2014-04-23  8:34 ` rguenth at gcc dot gnu.org
  2014-04-23  8:34 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-23  8:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60720

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed Apr 23 08:31:48 2014
New Revision: 209677

URL: http://gcc.gnu.org/viewcvs?rev=209677&root=gcc&view=rev
Log:
2014-04-23  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2014-04-14  Richard Biener  <rguenther@suse.de>

    PR lto/60720
    * lto-streamer-out.c (wrap_refs): New function.
    (lto_output): Wrap symbol references in global initializes in
    type-preserving MEM_REFs.

    * gcc.dg/lto/pr60720_0.c: New testcase.
    * gcc.dg/lto/pr60720_1.c: Likewise.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/lto/pr60720_0.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/lto/pr60720_1.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/lto-streamer-out.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


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

* [Bug lto/60720] clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941
  2014-03-31 12:41 [Bug lto/60720] New: clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941 rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-04-23  8:32 ` rguenth at gcc dot gnu.org
@ 2014-04-23  8:34 ` rguenth at gcc dot gnu.org
  2014-04-23  8:34 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-23  8:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60720

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.9.1
   Target Milestone|---                         |4.9.1

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for 4.9.1.


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

* [Bug lto/60720] clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941
  2014-03-31 12:41 [Bug lto/60720] New: clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941 rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-04-23  8:34 ` rguenth at gcc dot gnu.org
@ 2014-04-23  8:34 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-23  8:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60720

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2014-04-23  8:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-31 12:41 [Bug lto/60720] New: clisp fails to build with -flto: internal compiler error: tree check: expected array_type, have record_type in array_ref_low_bound, at expr.c:6941 rguenth at gcc dot gnu.org
2014-03-31 12:49 ` [Bug lto/60720] " rguenth at gcc dot gnu.org
2014-03-31 13:13 ` rguenth at gcc dot gnu.org
2014-04-14  8:36 ` rguenth at gcc dot gnu.org
2014-04-14  8:40 ` rguenth at gcc dot gnu.org
2014-04-23  8:32 ` rguenth at gcc dot gnu.org
2014-04-23  8:34 ` rguenth at gcc dot gnu.org
2014-04-23  8:34 ` rguenth at gcc dot gnu.org

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