[Bug c/88000] Warn when different local vars regs order may produce different and so unsupported code [-Wasm-register-var]

egallager at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jun 15 00:22:00 GMT 2019


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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2019-06-15
                 CC|                            |egallager at gcc dot gnu.org
         Resolution|INVALID                     |---
             Blocks|                            |87403
     Ever confirmed|0                           |1
            Summary|Different local vars regs   |Warn when different local
                   |order may produce different |vars regs order may produce
                   |and so wrong code           |different and so
                   |                            |unsupported code
                   |                            |[-Wasm-register-var]

--- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #4)
> 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.

Reopening to confirm the part about this warning request at least


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87403
[Bug 87403] [Meta-bug] Issues that suggest a new warning


More information about the Gcc-bugs mailing list