https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The NOP_EXPR comes from:
(gdb) up
#1 0x0000000000b99a72 in c_process_expr_stmt (loc=266752, expr=<parm_decl
0x7ffff7ff6080 x>) at
/home/apinski/src/upstream-gcc/gcc/gcc/c/c-typeck.cc:11356
11356 expr = build1 (NOP_EXPR, TREE_TYPE (expr), expr);
(gdb) l
11351
11352 /* If the expression is not of a type to which we cannot assign a
line
11353 number, wrap the thing in a no-op NOP_EXPR. */
11354 if (DECL_P (expr) || CONSTANT_CLASS_P (expr))
11355 {
11356 expr = build1 (NOP_EXPR, TREE_TYPE (expr), expr);
11357 SET_EXPR_LOCATION (expr, loc);
11358 }
But if you had a cast to void, it would come from somewhere else.
The strip is:
/* Strip away as many useless type conversions as possible
at the toplevel. */
STRIP_USELESS_TYPE_CONVERSION (*expr_p);
Now do we want to add a check inside STRIP_USELESS_TYPE_CONVERSION for
error_mark_node, I am still deciding.