Atm, when running vla-1.c with -O0 -flto, we have: ... FAIL: gcc.dg/guality/vla-1.c -O0 -flto -fuse-linker-plugin \ -fno-fat-lto-objects line 17 sizeof (a) == 6 ... The vla a[i + 1] in f1 is gimplified into: ... f1 (int i) { char a[0:D.1922] [value-expr: *a.0]; char[0:D.1922] * a.0; D.1921 = i + 1; D.1926 = (sizetype) D.1921; a.0 = __builtin_alloca_with_align (D.1926, 8); ... The early debug info for the upper bound of the type of vla a that we stream out is: ... DIE 0: DW_TAG_subrange_type (0x7f85029a90f0) DW_AT_upper_bound: location descriptor: (0x7f85029a9230) DW_OP_GNU_variable_value die -> 0 (0x7f85029a94b0), 0 DIE 0: DW_TAG_variable (0x7f85029a94b0) DW_AT_name: "D.1922" DW_AT_type: die -> 0 (0x7f85029a3d70) DW_AT_artificial: 1 ... and in ltrans we have for that same upper bound: ... DIE 0: DW_TAG_subrange_type (0x7f5183b57d70) DW_AT_upper_bound: die -> 0 (0x7f5183b576e0) DIE 0: DW_TAG_variable (0x7f5183b576e0) DW_AT_name: "D.4278" DW_AT_abstract_origin: die -> label: vla_1.c.6719312a + 193 (0x7f5183b57730) ... where D.4278 has abstract origin D.1922. The D.4278 die has no DW_AT_location, so when evaluting "sizeof (a)" in the debugger, we can't find the information to get the value of D.4278, and the debugger prints "<optimized out>". This patch fixes that by either: - adding DW_AT_location to the referenced variable die, or - instead of using a ref for the upper bound, using an exprloc. When changing gcc.dg/guality/guality.exp to run the usual flto flavours "-fno-use-linker-plugin -flto-partition=none" and "-fuse-linker-plugin -fno-fat-lto-objects" in combination with O0, Og, O1, O2, O3 and Os, this patch fixes all (20) failures in vla-1.c, leaving only: ... No symbol "i" in current context. UNSUPPORTED: gcc.dg/guality/vla-1.c -O3 -flto -fno-use-linker-plugin \ -flto-partition=none line 17 i == 5 'a' has unknown type; cast it to its declared type UNSUPPORTED: gcc.dg/guality/vla-1.c -O3 -flto -fno-use-linker-plugin \ -flto-partition=none line 17 sizeof (a) == 6 ... Bootstrapped and reg-tested on x86_64. 2018-08-20 Tom de Vries <tdevries@suse.de> * dwarf2out.c (add_scalar_info): Don't add reference to existing die unless the referenced die describes the added property using DW_AT_location or DW_AT_const_value. Fall back to exprloc case. Otherwise, add a DW_AT_location to the referenced die. From-SVN: r263660
Name |
Last commit
|
Last update |
---|---|---|
INSTALL | Loading commit data... | |
config | Loading commit data... | |
contrib | Loading commit data... | |
fixincludes | Loading commit data... | |
gcc | Loading commit data... | |
gnattools | Loading commit data... | |
gotools | Loading commit data... | |
include | Loading commit data... | |
intl | Loading commit data... | |
libada | Loading commit data... | |
libatomic | Loading commit data... | |
libbacktrace | Loading commit data... | |
libcc1 | Loading commit data... | |
libcpp | Loading commit data... | |
libdecnumber | Loading commit data... | |
libffi | Loading commit data... | |
libgcc | Loading commit data... | |
libgfortran | Loading commit data... | |
libgo | Loading commit data... | |
libgomp | Loading commit data... | |
libhsail-rt | Loading commit data... | |
libiberty | Loading commit data... | |
libitm | Loading commit data... | |
libobjc | Loading commit data... | |
liboffloadmic | Loading commit data... | |
libquadmath | Loading commit data... | |
libsanitizer | Loading commit data... | |
libssp | Loading commit data... | |
libstdc++-v3 | Loading commit data... | |
libvtv | Loading commit data... | |
lto-plugin | Loading commit data... | |
maintainer-scripts | Loading commit data... | |
zlib | Loading commit data... | |
.dir-locals.el | Loading commit data... | |
.gitattributes | Loading commit data... | |
.gitignore | Loading commit data... | |
ABOUT-NLS | Loading commit data... | |
COPYING | Loading commit data... | |
COPYING.LIB | Loading commit data... | |
COPYING.RUNTIME | Loading commit data... | |
COPYING3 | Loading commit data... | |
COPYING3.LIB | Loading commit data... | |
ChangeLog | Loading commit data... | |
ChangeLog.jit | Loading commit data... | |
ChangeLog.tree-ssa | Loading commit data... | |
MAINTAINERS | Loading commit data... | |
Makefile.def | Loading commit data... | |
Makefile.in | Loading commit data... | |
Makefile.tpl | Loading commit data... | |
README | Loading commit data... | |
compile | Loading commit data... | |
config-ml.in | Loading commit data... | |
config.guess | Loading commit data... | |
config.rpath | Loading commit data... | |
config.sub | Loading commit data... | |
configure | Loading commit data... | |
configure.ac | Loading commit data... | |
depcomp | Loading commit data... | |
install-sh | Loading commit data... | |
libtool-ldflags | Loading commit data... | |
libtool.m4 | Loading commit data... | |
ltgcc.m4 | Loading commit data... | |
ltmain.sh | Loading commit data... | |
ltoptions.m4 | Loading commit data... | |
ltsugar.m4 | Loading commit data... | |
ltversion.m4 | Loading commit data... | |
lt~obsolete.m4 | Loading commit data... | |
missing | Loading commit data... | |
mkdep | Loading commit data... | |
mkinstalldirs | Loading commit data... | |
move-if-change | Loading commit data... | |
symlink-tree | Loading commit data... | |
ylwrap | Loading commit data... |