[Bug middle-end/93926] New: [10 Regression] ICE: verify_cgraph_node failed (error: malloc attribute should be used for a function that returns a pointer)

asolokha at gmx dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 25 09:52:00 GMT 2020


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

            Bug ID: 93926
           Summary: [10 Regression] ICE: verify_cgraph_node failed (error:
                    malloc attribute should be used for a function that
                    returns a pointer)
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: ice-checking, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc-10.0.1-alpha20200223 snapshot (g:3133bed5d0327e8a9cd0a601b7ecdb9de4fc825d)
ICEs when compiling the following testcase on a 64-bit host w/ -m32 -fchecking:

long int
malloc (int);

int *
f (void)
{
  return (int *) malloc (sizeof (int));
}

% gcc-10.0.1 -m32 -c uivreegs.c
uivreegs.c:8:1: error: malloc attribute should be used for a function that
returns a pointer
    8 | }
      | ^
malloc/1 (malloc) @0x7f022025d168
  Type: function
  Visibility: external public
  References: 
  Referring: 
  Function flags:
  Called by: f/0 
  Calls: 
uivreegs.c:8:1: internal compiler error: verify_cgraph_node failed
0x92ae3e cgraph_node::verify_node()
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200223/work/gcc-10-20200223/gcc/cgraph.c:3755
0x91df74 symtab_node::verify()
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200223/work/gcc-10-20200223/gcc/symtab.c:1300
0x91f102 symtab_node::verify_symtab_nodes()
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200223/work/gcc-10-20200223/gcc/symtab.c:1320
0x931c24 symtab_node::checking_verify_symtab_nodes()
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200223/work/gcc-10-20200223/gcc/cgraph.h:667
0x931c24 symbol_table::compile()
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200223/work/gcc-10-20200223/gcc/cgraphunit.c:2720
0x933c5c symbol_table::compile()
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200223/work/gcc-10-20200223/gcc/cgraphunit.c:2717
0x933c5c symbol_table::finalize_compilation_unit()
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200223/work/gcc-10-20200223/gcc/cgraphunit.c:2984

Checking fails similarly for calloc(), strdup() and so on. When compiling w/
-m64, I see correct diagnostic instead:

% gcc-10.0.1 -c uivreegs.c
uivreegs.c:2:1: warning: conflicting types for built-in function 'malloc';
expected 'void *(long unsigned int)' [-Wbuiltin-declaration-mismatch]
    2 | malloc (int);
      | ^~~~~~
uivreegs.c:1:1: note: 'malloc' is declared in header '<stdlib.h>'
  +++ |+#include <stdlib.h>
    1 | long int


More information about the Gcc-bugs mailing list