Bug 486878 - -funit-at-a-time infinite recursion with VM type in function parameters
-funit-at-a-time infinite recursion with VM type in function parameters
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
9
All Linux
low Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-22 16:54 EST by Alexander Viro
Modified: 2009-03-03 05:59 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-03-03 05:59:24 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alexander Viro 2009-02-22 16:54:51 EST
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 05:59:24 EST
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.