https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99562

            Bug ID: 99562
           Summary: Invalid debug info: objdump: Warning: Location list
                    starting at offset 0x9c3 is not terminated.
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org, mark at gcc dot gnu.org
  Target Milestone: ---

The following produces an invalid debug info:

cat fsize.ii
template < class, class, class, class = void, class = void > struct expression;
template < class tag, class Arg1, class Arg2 >
struct expression< tag, Arg1, Arg2 > {};
template < class Backend > class number {
public:
  template < class tag, class Arg1, class Arg2, class Arg3, class Arg4 >
  void operator=(expression< tag, Arg1, Arg2, Arg3, Arg4 > e) {
    do_assign(e, int());
  }
  template < class tag, class Arg1, class Arg2, class Arg3, class Arg4 >
  number(expression< tag, Arg1, Arg2, Arg3, Arg4 > e) {
    *this = e;
  }
  template < class tag, class Arg1, class Arg2, class Arg3, class Arg4 >
  void do_assign(expression< tag, Arg1, Arg2, Arg3, Arg4 > e, int) {
    Backend __trans_tmp_3 ;
    eval_multiply(m_backend, __trans_tmp_3, canonical_value(e));
  }
  Backend m_backend;
  Backend canonical_value(number);
};
enum cpp_integer_type { signed_magnitude };
enum cpp_int_check_type { unchecked };
template < unsigned = 0, unsigned = 0, cpp_integer_type = signed_magnitude,
           cpp_int_check_type = unchecked, class = int >
struct Trans_NS_backends_cpp_int_backend;
struct cpp_int_base {
  bool m_alias;
  void allocator();
  cpp_int_base() {
    {
      if (m_alias)
        allocator();
    }
  }
};
template < unsigned, unsigned, cpp_integer_type, cpp_int_check_type, class >
struct Trans_NS_backends_cpp_int_backend : cpp_int_base {};
template < unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1,
           cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2,
           unsigned MaxBits2, cpp_integer_type SignType2,
           cpp_int_check_type Checked2, class Allocator2, unsigned MinBits3,
           unsigned MaxBits3, cpp_integer_type SignType3,
           cpp_int_check_type Checked3, class Allocator3 >
void
eval_multiply(Trans_NS_backends_cpp_int_backend< MinBits1, MaxBits1, SignType1,
                                                 Checked1, Allocator1 >,
              Trans_NS_backends_cpp_int_backend< MinBits2, MaxBits2, SignType2,
                                                 Checked2, Allocator2 >,
              Trans_NS_backends_cpp_int_backend< MinBits3, MaxBits3, SignType3,
                                                 Checked3, Allocator3 >) {
  Trans_NS_backends_cpp_int_backend<> t0;
  __int128 limb_max = ~static_cast< unsigned long >(0);
}
class FSize {
  number< Trans_NS_backends_cpp_int_backend<> > _size;
  FSize();
};
expression< int, int, int > __trans_tmp_13;
FSize::FSize() : _size(__trans_tmp_13) {}

$ g++ -gdwarf-4 fsize.ii -c -g -O && objdump -g fsize.o >/dev/null
objdump: Warning: Location list starting at offset 0x9c3 is not terminated.
objdump: Warning: There is a hole [0x9f9 - 0xa0f] in .debug_loc section.
objdump: Warning: Location list starting at offset 0xa8b is not terminated.
objdump: Warning: There is a hole [0xac1 - 0xad7] in .debug_loc section.
objdump: Warning: Location list starting at offset 0xb53 is not terminated.
objdump: Warning: There is a hole [0xb89 - 0xb9f] in .debug_loc section.
objdump: Warning: Location list starting at offset 0xc1b is not terminated.
objdump: Warning: There is a hole [0xc51 - 0xc67] in .debug_loc section.

Reply via email to