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

            Bug ID: 62190
           Summary: LTO DWARF produces __unknown__ type for unsigned int
                    function argument type
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mark at gcc dot gnu.org

Take the following program:

/* LTO sometimes outputs __unknown__ for an unsigned int argument type. */
/* { dg-do run } */
/* { dg-options "-gdwarf" } */

static __attribute__((noclone, noinline)) int
func (unsigned int n)
{
  return (int) n;
}

int
main (int argc, char **argv)
{
  return func (0);
}

/* { dg-final { gdb-test 12 "type:func" "int (unsigned int)" } } */

And compile it with /opt/local/build/gcc-obj/gcc/xgcc
-B/opt/local/build/gcc-obj/gcc/ ltounsignedint.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none -g -o ./ltounsignedint.exe

Or just drop it in gcc/testsuite/gcc.dg/guality/ltounsignedint.c and run make
check-c RUNTESTFLAGS=guality.exp=ltounsignedint.c

Notice how the formal_parameter n gets a type with name "__unknown__":

 [    46]      formal_parameter
               name                 (string) "n"
               decl_file            (data1) 1
               decl_line            (data1) 6
               type                 (ref4) [    59]
               location             (exprloc) 
                [   0] reg5

 [    59]    base_type
             byte_size            (data1) 4
             encoding             (data1) unsigned (7)
             name                 (strp) "__unknown__"

Reply via email to