Bug 46360 - [4.6 Regression] ICE in release_defs, at tree-ssanames.c:313
Summary: [4.6 Regression] ICE in release_defs, at tree-ssanames.c:313
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-08 12:14 UTC by Richard Biener
Modified: 2010-11-09 11:59 UTC (History)
2 users (show)

See Also:
Host:
Target: i?86-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-11-08 14:50:25


Attachments
preprocessed source (38.79 KB, application/x-bzip)
2010-11-08 12:14 UTC, Richard Biener
Details
gcc46-pr46360.patch (740 bytes, patch)
2010-11-08 19:57 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2010-11-08 12:14:10 UTC
Created attachment 22321 [details]
preprocessed source

The package ebook-tools fails to build with

/usr/bin/gcc  -Depub_EXPORTS -Wall -W -Wno-long-long -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -Wshadow -fno-common -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g  -fPIC -I/usr/src/packages/BUILD/ebook-tools-0.2.0/src/libepub -I/usr/include/libxml2   -o CMakeFiles/epub.dir/epub.o   -c /usr/src/packages/BUILD/ebook-tools-0.2.0/src/libepub/epub.c
/usr/src/packages/BUILD/ebook-tools-0.2.0/src/libepub/epub.c: In function 'epub_open':
/usr/src/packages/BUILD/ebook-tools-0.2.0/src/libepub/epub.c:19:3: internal compiler error: in release_defs, at tree-ssanames.c:313
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.opensuse.org/> for instructions.

and the cause is -Wwrite-strings as the attached testcase shows

> ./cc1 -quiet ~/epub.i -m32 -Wwrite-strings 
/usr/src/packages/BUILD/ebook-tools-0.2.0/src/libepub/epub.c: In function 'epub_open':
/usr/src/packages/BUILD/ebook-tools-0.2.0/src/libepub/epub.c:19:15: internal compiler error: in release_defs, at tree-ssanames.c:313
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 H.J. Lu 2010-11-08 14:50:25 UTC
It is caused by revision 164438:

http://gcc.gnu.org/ml/gcc-cvs/2010-09/msg00734.html
Comment 2 Jakub Jelinek 2010-11-08 19:18:37 UTC
Reduced testcase (fails without any options, -Wwrite-strings is not needed):

__attribute__((gnu_inline, always_inline)) extern inline char *
strncpy (char *dest, const char *src, __SIZE_TYPE__ len)
{
  return __builtin_strncpy (dest, src, len);
}

void
foo (char *s)
{
  strncpy (s, "", 0);
}

The problem is the fold_stmt Honza added to gimplify_call_expr.  
Unfortunately fold_stmt doesn't expect it is being called when still not in SSA form.  Seems
gimplify_and_update_call_from_tree
has been adjusted for that in PR45073, but
update_call_from_tree still needs doing that.  Will work on it tomorrow.
Comment 3 Jakub Jelinek 2010-11-08 19:57:07 UTC
Created attachment 22336 [details]
gcc46-pr46360.patch

Untested fix.
Comment 4 Jakub Jelinek 2010-11-09 11:54:39 UTC
Author: jakub
Date: Tue Nov  9 11:54:32 2010
New Revision: 166482

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166482
Log:
	PR middle-end/46360
	* tree-ssa-propagate.c (update_call_from_tree): Fix for use
	not in SSA mode.

	* gcc.c-torture/compile/pr46360.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr46360.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-propagate.c
Comment 5 Jakub Jelinek 2010-11-09 11:59:42 UTC
Fixed.