https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88000
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- GCC could help by issuing a warning for unsupported uses, like in the prototype patch below: Index: gcc/c/c-typeck.c =================================================================== --- gcc/c/c-typeck.c (revision 266033) +++ gcc/c/c-typeck.c (working copy) @@ -6505,6 +6505,14 @@ convert_for_assignment (location_t location, locat objc_ok = objc_compare_types (type, rhstype, parmno, rname); } + if (VAR_P (rhs) && DECL_HARD_REGISTER (rhs) + && warning_at (expr_loc, OPT_Wasm_register_var, + "unsupported use of a hard register %qD as " + "argument %d of %qE", + rhs, parmnum, rname)) + inform (DECL_SOURCE_LOCATION (rhs), + "%qD declared here", rhs); + if (warn_cxx_compat) { tree checktype = origtype != NULL_TREE ? origtype : rhstype; Index: gcc/c-family/c.opt =================================================================== --- gcc/c-family/c.opt (revision 266033) +++ gcc/c-family/c.opt (working copy) @@ -338,6 +338,10 @@ Warray-bounds= LangEnabledBy(C ObjC C++ LTO ObjC++,Wall,1,0) ; in common.opt +Wasm-register-var +ObjC ObjC++ Var(warn_asm_register_var) Warning LangEnabledBy(C ObjC C++ ObjC++, Wall) +Warn for unsupported uses of variables declared asm register. + Wassign-intercept ObjC ObjC++ Var(warn_assign_intercept) Warning Warn whenever an Objective-C assignment is being intercepted by the garbage collector.