Bug 486878 - -funit-at-a-time infinite recursion with VM type in function parameters
Summary: -funit-at-a-time infinite recursion with VM type in function parameters
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 9
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-02-22 21:54 UTC by Alexander Viro
Modified: 2009-03-03 10:59 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2009-03-03 10:59:24 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Alexander Viro 2009-02-22 21:54:51 UTC
Description of problem:
Function definition below gets an infinite recursion with -funit-at-a-time (resulting in cc1 segfault) and loses the function from assembler output
without -funit-at-a-time

Version-Release number of selected component (if applicable):
At least from 4.1.2 to 4.3.x; almost certainly an upstream bug.  Exactly the same breakage happens on RH and Debian gcc builds.

How reproducible:

echo 'int f(int n, char (*s)[n ? f(n - 1, 0) * n : 1]) { return sizeof *s; }' >a.c
gcc -funit-at-a-time -S a.c
and watch it segfault.

Immediate cause is cgraph_remove_node() getting node with node->nested == node,
which triggers infinite recursion.

Strictly speaking, it _is_ a nasal daemon country - the scope of f starts only at the end of its declarator, so we have an implicit declaration in there.  However,
segfaulting compiler (let alone OOM triggered by compiler, if you are an idiot and don't have sane ulimit settings) is a bit excessive way to express that.

-HEAD seems to have that code rewritten, so it might or might not be OK; I don't have a -HEAD build at hand to check.

Comment 1 Jakub Jelinek 2009-03-03 10:59:24 UTC
Works with gcc 4.4, not severe enough to care about in 4.3 or earlier.


Note You need to log in before you can comment on or make changes to this bug.