The following fixes an issue with LTO and debug info of OMP vars. LTO bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard. 2016-01-25 Richard Biener <rguent...@suse.de> PR lto/69393 * dwarf2out.c (is_naming_typedef_decl): Not when DECL_NAMELESS. * tree-streamer-out.c (pack_ts_base_value_fields): Stream DECL_NAMELESS. * tree-streamer-in.c (unpack_ts_base_value_fields): Likewise. * testsuite/libgomp.c++/pr69393.C: New testcase. Index: gcc/dwarf2out.c =================================================================== *** gcc/dwarf2out.c (revision 232717) --- gcc/dwarf2out.c (working copy) *************** is_naming_typedef_decl (const_tree decl) *** 22970,22975 **** --- 22970,22976 ---- { if (decl == NULL_TREE || TREE_CODE (decl) != TYPE_DECL + || DECL_NAMELESS (decl) || !is_tagged_type (TREE_TYPE (decl)) || DECL_IS_BUILTIN (decl) || is_redundant_typedef (decl) Index: gcc/tree-streamer-out.c =================================================================== *** gcc/tree-streamer-out.c (revision 232717) --- gcc/tree-streamer-out.c (working copy) *************** pack_ts_base_value_fields (struct bitpac *** 87,93 **** bp_pack_value (bp, TREE_ADDRESSABLE (expr), 1); bp_pack_value (bp, TREE_THIS_VOLATILE (expr), 1); if (DECL_P (expr)) ! bp_pack_value (bp, DECL_UNSIGNED (expr), 1); else if (TYPE_P (expr)) bp_pack_value (bp, TYPE_UNSIGNED (expr), 1); else --- 87,96 ---- bp_pack_value (bp, TREE_ADDRESSABLE (expr), 1); bp_pack_value (bp, TREE_THIS_VOLATILE (expr), 1); if (DECL_P (expr)) ! { ! bp_pack_value (bp, DECL_UNSIGNED (expr), 1); ! bp_pack_value (bp, DECL_NAMELESS (expr), 1); ! } else if (TYPE_P (expr)) bp_pack_value (bp, TYPE_UNSIGNED (expr), 1); else Index: gcc/tree-streamer-in.c =================================================================== *** gcc/tree-streamer-in.c (revision 232717) --- gcc/tree-streamer-in.c (working copy) *************** unpack_ts_base_value_fields (struct bitp *** 116,122 **** TREE_ADDRESSABLE (expr) = (unsigned) bp_unpack_value (bp, 1); TREE_THIS_VOLATILE (expr) = (unsigned) bp_unpack_value (bp, 1); if (DECL_P (expr)) ! DECL_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1); else if (TYPE_P (expr)) TYPE_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1); else --- 116,125 ---- TREE_ADDRESSABLE (expr) = (unsigned) bp_unpack_value (bp, 1); TREE_THIS_VOLATILE (expr) = (unsigned) bp_unpack_value (bp, 1); if (DECL_P (expr)) ! { ! DECL_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1); ! DECL_NAMELESS (expr) = (unsigned) bp_unpack_value (bp, 1); ! } else if (TYPE_P (expr)) TYPE_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1); else Index: libgomp/testsuite/libgomp.c++/pr69393.C =================================================================== *** libgomp/testsuite/libgomp.c++/pr69393.C (revision 0) --- libgomp/testsuite/libgomp.c++/pr69393.C (working copy) *************** *** 0 **** --- 1,16 ---- + // { dg-do run } + // { dg-require-effective-target lto } + // { dg-options "-flto -g -fopenmp" } + + int e = 5; + + int + main () + { + int a[e]; + a[0] = 6; + #pragma omp parallel + if (a[0] != 6) + __builtin_abort (); + return 0; + }