Bug 28980 - [4.0 Regression] ICE in loc_descriptor_from_tree_1 with -g
Summary: [4.0 Regression] ICE in loc_descriptor_from_tree_1 with -g
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.0.4
Assignee: Andrew Pinski
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-checking, ice-on-valid-code, patch
Depends on: 27893
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-08 04:10 UTC by Gabriel Stephenson
Modified: 2006-10-09 04:27 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-09-08 04:33:23


Attachments
The preprocessed source that causes this bug. (16.81 KB, text/plain)
2006-09-08 04:11 UTC, Gabriel Stephenson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriel Stephenson 2006-09-08 04:10:00 UTC
internal compiler error: in tree_low_cst, at tree.c:4423

First, If I run this with -E, I get the preprocessed source that I will attach.

vmfreebsd# gcc42 -E -g -I/usr/local/include -I/root/devel/dynamos/src/shared/include -I/root/devel/dynamos/src/framework/include -I/root/devel/dynamos/src/disassembler/slicer/include -I/root/devel/dynamos/src/os/include -I/root/devel/dynamos/config -I/root/devel/dynamos/src/libslicer/include -I/root/devel/dynamos/devel/include -c dynreplace.c > preprocessed_source.c


And now, the bug:

vmfreebsd# gcc42 -g -I/usr/local/include -I/root/devel/dynamos/src/shared/include -I/root/devel/dynamos/src/framework/include -I/root/devel/dynamos/src/disassembler/slicer/include -I/root/devel/dynamos/src/os/include -I/root/devel/dynamos/config -I/root/devel/dynamos/src/libslicer/include -I/root/devel/dynamos/devel/include -c dynreplace.c
dynreplace.c: In function 'dynreplace_add_trampoline':
dynreplace.c:71: warning: incompatible implicit declaration of built-in function 'memcpy'
dynreplace.c:48: internal compiler error: in tree_low_cst, at tree.c:4423
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

vmfreebsd# gcc42 --version
gcc42 (GCC) 4.2.0 20060218 (experimental)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

vmfreebsd# uname -a
FreeBSD vmfreebsd.mkgnu.net 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May  7 04:32:43 UTC 2006 root@opus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386


This is running inside a VMWare virtual machine loaded with FreeBSD 6.1.

No bug occurs when compiling with gcc-2.95 or gcc-3.3.4.
Comment 1 Gabriel Stephenson 2006-09-08 04:11:20 UTC
Created attachment 12210 [details]
The preprocessed source that causes this bug.
Comment 2 Gabriel Stephenson 2006-09-08 04:14:06 UTC
gcc42 originated from running a:

# pkg_add -r gcc42

in FreeBSD 6.1. This command installed the package gcc-4.2.0_20060218
Comment 3 Andrew Pinski 2006-09-08 04:20:48 UTC
Well 20060218 is almost 7 months ago but I get a different error with the mainline as of yesterday:
dynreplace.c:110: internal compiler error: in loc_descriptor_from_tree_1, at dwarf2out.c:9407
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 4 Andrew Pinski 2006-09-08 04:31:34 UTC
Reduced testcase:
extern void dynreplace_trampoline(void);
extern void dynreplace_trampoline_endlabel(void);
int dynreplace_add_trampoline(void)
{
  unsigned long trampoline_code[(((unsigned long) (&(dynreplace_trampoline_endlabel))
-(unsigned long) (&dynreplace_trampoline)))
];
}
Comment 5 Andrew Pinski 2006-09-08 04:33:22 UTC
Confirmed, note this is semi undefined code.  Really this is a big weird as we are taking the difference between two function pointers.  I think the ICE with tree_low_cst has been fixed but the ICE with loc_descriptor_from_tree_1 still exists.
Comment 6 Andrew Pinski 2006-09-08 04:44:36 UTC
This is just like PR 14492 now.

Janis,
  Could you do a regression hunt on when the reduced testcase in comment #4 started to pass without any options?

Thanks,
Andrew
Comment 7 Janis Johnson 2006-09-08 19:11:18 UTC
A regression hunt on powerpc-linux, using the reduced testcase from comment #4 with no options, identified this patch for which that test starts compiling cleanly:

    http://gcc.gnu.org/viewcvs?view=rev&rev=116450

    r116450 | jsm28 | 2006-08-25 23:01:16 +0000 (Fri, 25 Aug 2006)
Comment 8 Andrew Pinski 2006-09-08 19:14:31 UTC
So the ICE in tree_low_cst has been fixed in the next releases of GCC 4.1.x and 4.0.x, that is good news but we still have the ICE in loc_descriptor_from_tree_1 now.
Comment 9 Andrew Pinski 2006-09-09 18:23:01 UTC
I have a fix for this which I am testing right now.
Comment 10 patchapp@dberlin.org 2006-09-14 00:15:14 UTC
Subject: Bug number PR 28980

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00525.html
Comment 11 Andrew Pinski 2006-09-14 00:37:24 UTC
Subject: Bug 28980

Author: pinskia
Date: Thu Sep 14 00:37:14 2006
New Revision: 116939

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116939
Log:

2006-09-13  Andrew Pinski  <pinskia@physics.uc.edu>

	PR debug/28980
        * dwarf2out.c (loc_descriptor_from_tree_1): Handle
        FUNCTION_DECL.

2006-09-13  Andrew Pinski  <pinskia@physics.uc.edu>

	PR debug/28980
        * gcc.c-torture/compile/debugvlafunction-1.c: New test.



Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/testsuite/ChangeLog

Comment 12 Andrew Pinski 2006-09-14 00:38:16 UTC
Fixed on the mainline at least.
Comment 13 Andrew Pinski 2006-10-05 14:33:56 UTC
Subject: Bug 28980

Author: pinskia
Date: Thu Oct  5 14:33:46 2006
New Revision: 117456

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117456
Log:
2006-10-05  Andrew Pinski  <pinskia@physics.uc.edu>

        PR debug/28980
        * dwarf2out.c (loc_descriptor_from_tree_1): Handle
        FUNCTION_DECL.

2006-10-05  Andrew Pinski  <pinskia@physics.uc.edu>

        PR debug/28980
        * gcc.c-torture/compile/debugvlafunction-1.c: New test.




Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c
      - copied unchanged from r116939, trunk/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/dwarf2out.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 14 Andrew Pinski 2006-10-05 14:34:14 UTC
Fixed in 4.1 also.
Comment 15 Andrew Pinski 2006-10-09 04:25:58 UTC
Subject: Bug 28980

Author: pinskia
Date: Mon Oct  9 04:25:44 2006
New Revision: 117568

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117568
Log:
2006-10-08  Andrew Pinski  <pinskia@physics.uc.edu>

        PR debug/28980
        * dwarf2out.c (loc_descriptor_from_tree_1): Handle
        FUNCTION_DECL.

2006-10-08  Andrew Pinski  <pinskia@physics.uc.edu>

        PR debug/28980
        * gcc.c-torture/compile/debugvlafunction-1.c: New test.




Added:
    branches/gcc-4_0-branch/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c
      - copied unchanged from r116939, trunk/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c
Modified:
    branches/gcc-4_0-branch/gcc/ChangeLog
    branches/gcc-4_0-branch/gcc/dwarf2out.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog

Comment 16 Andrew Pinski 2006-10-09 04:27:07 UTC
Fixed.