FAIL: gcc (GCC) 4.5.0 20100119 (experimental) PASS: gcc (GCC) 4.4.3 20100119 (prerelease) PASS: gcc-4.4.2-20.fc12.x86_64 (Fedora 12) ------------------------------------------------------------------------------- gcc -c -o vla.o vla.c -Wall -g ------------------------------------------------------------------------------- This is a 4.4 -> 4.5 debug regression. ------------------------------------------------------------------------------- int f (int i) { char a[i]; return a[0]; } ------------------------------------------------------------------------------- FAIL: < c> DW_AT_producer : (indirect string, offset: 0x11): GNU C 4.5.0 20100119 (experimental) <2><5c>: Abbrev Number: 4 (DW_TAG_variable) <5d> DW_AT_name : a <61> DW_AT_type : <0x71> <65> DW_AT_location : 3 byte block: 91 60 6 (DW_OP_fbreg: -32; DW_OP_deref) <1><71>: Abbrev Number: 6 (DW_TAG_array_type) <72> DW_AT_type : <0x83> <2><7a>: Abbrev Number: 7 (DW_TAG_subrange_type) <7b> DW_AT_type : <0x80> ------------------------------------------------------------------------------- PASS: < c> DW_AT_producer : (indirect string, offset: 0x17): GNU C 4.4.3 20100119 (prerelease) <2><5c>: Abbrev Number: 4 (DW_TAG_variable) <5d> DW_AT_name : a <61> DW_AT_type : <0x71> <65> DW_AT_location : 3 byte block: 91 68 6 (DW_OP_fbreg: -24; DW_OP_deref) <1><71>: Abbrev Number: 6 (DW_TAG_array_type) <72> DW_AT_type : <0x87> <2><7a>: Abbrev Number: 7 (DW_TAG_subrange_type) <7b> DW_AT_type : <0x84> <7f> DW_AT_upper_bound : 3 byte block: 91 60 6 (DW_OP_fbreg: -32; DW_OP_deref)
It is caused by Expand from SSA: http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg01459.html
What's the brokenness? The missing upper bound in the subrange type?
(In reply to comment #2) > What's the brokenness? The missing upper bound in the subrange type? > It blocks PR 42801.
Yes. This is -O0, so we definitely should ensure that the debug info has the correct upper bound. Look at gimplify_type_sizes which for -O0 clears DECL_IGNORED_P on the temporaries to make sure they are not optimized out. That worked well in 4.4, but probably doesn't work any longer.
The problem is that instantiate_decl_rtl isn't being run on the rtl for the upper bound temporary, because it isn't visible to instantiate_decls. This happens because even though the temp got added to cfun->local_decls, expand_used_vars clears it out before instantiate_decls gets a chance to look at it.
Yeah, the Expand from SSA patch broke Jakub's fix for PR 34037. I'm testing a patch that just tweaks the logic a bit to make it work again.
Created attachment 19929 [details] patch
Fixed.
Subject: Bug 42800 Author: jason Date: Tue Feb 23 18:32:09 2010 New Revision: 157014 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157014 Log: PR debug/42800 * cfgexpand.c (expand_used_vars): Keep artificial non-ignored vars in cfun->local_decls even if they have register types. Added: trunk/gcc/testsuite/c-c++-common/dwarf2/ trunk/gcc/testsuite/c-c++-common/dwarf2/vla1.c Modified: trunk/gcc/ChangeLog trunk/gcc/cfgexpand.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2.exp trunk/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp