https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125604
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at gcc dot gnu.org
--- Comment #1 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Seeing basically the same thing building the linux kernel on microblaze-elf:
typedef unsigned int size_t;
struct strarray {
char **array __attribute__((__counted_by__(n)));
size_t n;
};
char **devm_kasprintf_strarray(struct strarray *ptr)
{
if (!ptr->array)
return ERR_PTR(-12);
}
Compile with -O2:
j.c:8:2: internal compiler error: in build_unary_op, at c/c-typeck.cc:5790
8 | if (!ptr->array)
| ^~
0x279f438 internal_error(char const*, ...)
../../../gcc/gcc/diagnostic-global-context.cc:787
0x27adf6d fancy_abort(char const*, int, char const*)
../../../gcc/gcc/diagnostics/context.cc:1813
0xbba5a4 build_unary_op(unsigned long, tree_code, tree_node*, bool)
../../../gcc/gcc/c/c-typeck.cc:5790
0xbb7780 parser_build_unary_op(unsigned long, tree_code, c_expr)
../../../gcc/gcc/c/c-typeck.cc:5057
0xc1fae4 c_parser_unary_expression
../../../gcc/gcc/c/c-parser.cc:10792
0xc1ec3f c_parser_cast_expression
../../../gcc/gcc/c/c-parser.cc:10656
0xc1c555 c_parser_binary_expression
../../../gcc/gcc/c/c-parser.cc:10420
0xc1b9af c_parser_conditional_expression
../../../gcc/gcc/c/c-parser.cc:10110
0xc1b5a3 c_parser_expr_no_commas
[ ... ]