https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103329
Bug ID: 103329 Summary: [11/12 Regression] Code divergence in debug info with -fdump-tree-original since r11-291-g0f50f6daa140186a Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: jason at gcc dot gnu.org Target Milestone: --- Since the revision, the following test-case: $ cat vectors.ii template <typename> struct __is_integer { enum { __value }; }; template <typename _Tp, bool = __is_integer<_Tp>::__value> struct __promote { typedef double __type; }; template <typename, typename _Up> using __promote_2 = __promote<_Up>; template <typename _Tp, typename _Up> typename __promote_2<_Tp, _Up>::__type pow(_Tp, _Up) {} template <typename> struct Vector { typedef int iterator; virtual ~Vector(); }; template <int> class DoFHandler; template <int> struct MappingQ1 { MappingQ1(); static const unsigned vertex_mapping[]; }; template <> const unsigned MappingQ1<3>::vertex_mapping[]; struct DerivativeApproximation { template <int dim, class InputVector> void approximate_second_derivative(const DoFHandler<dim> &, const InputVector &, Vector<float> &, unsigned); template <int> struct SecondDerivative { typedef int Derivative; double derivative_norm(const Derivative &); }; }; template <> double DerivativeApproximation::SecondDerivative<3>::derivative_norm( const Derivative &) { int s(pow(s, 3)); } template <int dim, class InputVector> void DerivativeApproximation::approximate_second_derivative( const DoFHandler<dim> &, const InputVector &, Vector<float> &, unsigned) { static MappingQ1<dim> index_interval; Vector<float>::iterator derivative_norm_on_this_cell; } template void DerivativeApproximation::approximate_second_derivative( const DoFHandler<3> &, const double &, Vector<float> &, unsigned); $ g++ -O1 -g -w -fPIC -shared vectors.ii -o 1 -fdump-tree-original=/dev/null && cp 1 2 && g++ -O1 -g -w -fPIC -shared vectors.ii -o 1 && diff 1 2 Binary files 1 and 2 differ It makes difference in debug info: $ objdump -W 1 > 11 $ objdump -W 2 > 22 $ diff -u 11 22 ... Contents of the .eh_frame section: @@ -86,7 +86,7 @@ 0000000000000000 0000000000000000 Length: 60 Version: 2 - Offset into .debug_info: 0x395 + Offset into .debug_info: 0x3b2 Pointer Size: 8 Segment Size: 0 @@ -111,21 +111,21 @@ <1d> DW_AT_producer : (indirect string, offset: 0x32): GNU AS 2.37 <21> DW_AT_language : 32769 (MIPS assembler) Compilation Unit @ offset 0x23: - Length: 0x36e (32-bit) + Length: 0x38b (32-bit) Version: 5 Unit Type: DW_UT_compile (1) Abbrev Offset: 0x12 Pointer Size: 8 <0><2f>: Abbrev Number: 17 (DW_TAG_compile_unit) - <30> DW_AT_producer : (indirect string, offset: 0x2ab): GNU C++17 12.0.0 20211118 (experimental) -mtune=generic -march=x86-64 -g -O1 -fPIC + <30> DW_AT_producer : (indirect string, offset: 0x2c5): GNU C++17 12.0.0 20211118 (experimental) -mtune=generic -march=x86-64 -g -O1 -fPIC <34> DW_AT_language : 33 (C++14) <35> DW_AT_name : (indirect line string, offset: 0x19): vectors.ii <39> DW_AT_comp_dir : (indirect line string, offset: 0x24): /home/marxin/Programming/testcases <3d> DW_AT_ranges : 0x2d <41> DW_AT_low_pc : 0x0 <49> DW_AT_stmt_list : 0x67 ...