Bug 25566 - Variable length types and inlining
Summary: Variable length types and inlining
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.2.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: FIXME, missed-optimization
Depends on:
Blocks:
 
Reported: 2005-12-26 03:58 UTC by Andrew Pinski
Modified: 2010-07-15 23:05 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-29 17:32:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-12-26 03:58:15 UTC
According to the following comment:
      /* We cannot inline a function of the form

           void F (int i) { struct S { int ar[i]; } s; }

         Attempting to do so produces a catch-22.
         If walk_tree examines the TYPE_FIELDS chain of RECORD_TYPE/
         UNION_TYPE nodes, then it goes into infinite recursion on a
         structure containing a pointer to its own type.  If it doesn't,
         then the type node for S doesn't get adjusted properly when
         F is inlined.

         ??? This is likely no longer true, but it's too late in the 4.0
         cycle to try to find out.  This should be checked for 4.1.  */

We don't inline functions with variable length types but we should check this out for 4.1 (but it is too late even for 4.1).
Comment 1 Andrew Pinski 2005-12-26 03:58:39 UTC
Oh, forgot to say this comment is in tree-inline.c.
Comment 2 Andrew Pinski 2006-01-29 17:32:20 UTC
Confirmed.
Comment 3 Andrew Pinski 2006-08-21 06:15:50 UTC
I think the comment can just go away since we are lowering the VL variables before inlining so we get alloca now. 
Comment 4 Steven Bosscher 2010-07-15 23:05:17 UTC
Fixed in the previous decade.