This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/43381] [4.4/4.5 Regression] infinite loop in gcc.dg/parm-impl-decl-1.c with -g



------- Comment #4 from jakub at gcc dot gnu dot org  2010-03-17 09:20 -------
Actually, this seems to be a C FE bug, corruption of TREE_CHAIN chains.
The reason for dwarf2out hanging is that in foo we have a block:
BLOCK #0 [written] 
  SUPERCONTEXT: foo
  VARS: vector_size foo i h 
Note that the foo in both cases is the same, i.e. in function_decl
0x7ffff1d6db00 block 0x7ffff1d6db00 is in the BLOCK_VARS chain.

First vector_size() is added to foo's parameter scope (depth 2) BLOCK_VARs,
then i() is added to h's parameter scope (depth 2) BLOCK_VARs.
Then h() is added to external scope (depth 0).  Then i() (after duplicate_decls
which resulted in the i() that has been already added earlier to h's parameter
scope) is added to external scope (depth 0).  Then foo() is added to external
scope (depth 0).  Finally vector_size() is added to external scope.
Given that i() and vector_size() are referenced from both the external_scope
and
function's parameter_scope, in both cases the same tree, and BLOCK_VARs are
chained through TREE_CHAIN, this obviously doesn't work very well, so while
foo's parameter scope was supposed to contain just vector_size(), it now
contains all the FUNCTION_DECLs added to external_scope.  And, while h's
parameter scope was supposed to contain just i(), it now contains i() and h()
too.  Joseph, could you please look at this?  I'm not sure if the right fix is
force these implicit declarations in fn parameters as externs (i.e. BLOCK_VARs
contains a copy of the decl rather than the decl itself), or ensure
pushdecl/duplicate_decls from other functions doesn't find them.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu dot org
         AssignedTo|jakub at gcc dot gnu dot org|unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW
          Component|debug                       |c


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43381


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]