[Bug c++/108238] returns_nonnull attribute with auto return type fails to compile

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 28 18:59:23 GMT 2022


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |rejects-valid
   Last reconfirmed|                            |2022-12-28
      Known to fail|                            |4.9.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, not a regression.

Some debugging:

#1  0x00000000011e6010 in handle_returns_nonnull_attribute
(node=0x7fffffffd4b0, name=0x7ffff72bd9c0, no_add_attrs=0x7fffffffd4cf) at
/home/apinski/src/upstream-gcc/gcc/gcc/c-family/c-attribs.cc:5761
5761          error ("%qE attribute on a function not returning a pointer",
name);


5758      // Even without a prototype we still have a return type we can check.
5759      if (TREE_CODE (TREE_TYPE (*node)) != POINTER_TYPE)

(gdb) p debug_tree(*node)
 <function_type 0x7ffff74399d8
    type <template_type_parm 0x7ffff7439930 auto VOID
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff74361f8
       index 0 level 1 orig_level 1
        chain <type_decl 0x7ffff72bfc78 auto>>
    QI
    size <integer_cst 0x7ffff72b30c0 type <integer_type 0x7ffff72b10a8
bitsizetype> constant 8>
    unit-size <integer_cst 0x7ffff72b30d8 type <integer_type 0x7ffff72b1000
sizetype> constant 1>
    align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff74362a0
    arg-types <tree_list 0x7ffff72a7d98
        value <void_type 0x7ffff72b1f18 void VOID
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff72b1f18
            pointer_to_this <pointer_type 0x7ffff72b9000>>>>


More information about the Gcc-bugs mailing list