]> git.ipfire.org Git - thirdparty/gcc.git/commit
DWARF: for variants, produce unsigned discr. when debug type is unsigned
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Jun 2017 08:36:57 +0000 (08:36 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Jun 2017 08:36:57 +0000 (08:36 +0000)
commit6970560569a6c81b579bb1353e5c1fc38a5abf7d
treecdd7675142b8599bcec2e279fab4666ff82886c1
parent6cf2f0b685a07e987390c82ca6ac1b4cd18bab6e
DWARF: for variants, produce unsigned discr. when debug type is unsigned

In Ada, the Character type is supposed to be unsigned.  However,
depending on the sign of C char types, GNAT can materialize it as a
signed type for code generation purposes.  When this is the case, GNAT
also attach a debug type to it so it is represented as an unsigned base
type in the debug information.

This change adapts record variant parts processing in the DWARF back-end
so that when the debug type of discriminant is unsigned while
discriminant values are signed themselves, we output unsigned
discriminant values in DWARF.

gcc/

* dwarf2out.c (get_discr_value): Call the get_debug_type hook on
the type of the input discriminant value.  Convert the
discriminant value of signedness vary.

gcc/testsuite/

* gnat.dg/debug11.adb: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248773 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/debug11.adb [new file with mode: 0644]