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

--- Comment #11 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Warning for "2 ^ INT" seems reasonable, maybe just for that (I think I agree
with comment #6).

Not sure what to call it: "-Wexclusive-or"???

I think we'd want to *not* warn if either of the operands are from a macro
expansion.

I think both operands ought to be decimal integers to trigger the warning.

I like the wording from comment #2: "2 ^ 30 is 28, not 1073741824.", to make it
clear what's going on (I hope).

Other idea: fix-it hints.

So maybe something like:

t.c:10:5: warning: '2^30' is 28; did you mean '1<<30' (1073741824)
[-Wexclusive-or]

  log.Infof("Setting total memory to %.2f GB", float64(args.TotalMem)/(2^30))
                                                                       ~^~~
                                                                       1<<30

or somesuch.

Reply via email to