On 07/13/2018 01:57 AM, Jim Wilson wrote:
I poked at this a little and noticed a difference between the x86_64
support and the RISC-V support.  The RISC-V C language port has char
as unsigned by default.  The x86_64 port has char signed by default.
If I add a -fsigned-char option, then the testcase works as expected
for RISC-V.  Curiously, the Ada compiler accepts -fsigned-char but not
-funsigned-char.  I tried hacking in a -funsigned-char flag, but when
I use it with the x86_64 port the result is still correct.  Maybe my
quick hack wasn't quite right.  Anyways, the default signedness of
char has something to do with the problem.


Ah, interesting! Last year, we installed specific code in the Ada front end and the DWARF back end to handle discrepancies between the INTEGER_TYPE signedness and the signedness to appear in debug info (https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/dwarf2out.c;h=c2422e29658b6a101034318deed224271e6f1ca7;hb=HEAD#l24561), but ironically here, it seems that we don’t handle properly when everything is unsigned.

I think the current testcase should work on RISC-V even without -fsigned-char: Character’s debug type should be unsigned in all cases. Maybe for some reason we don’t create the correct debug type in the Ada front end… Do you think I can reproduce this with a x86_64-linux compiler targetting something like riscv-elf? I don’t have access to a RISC-V board on which to build GCC.

--
Pierre-Marie de Rodat

Reply via email to