[llvm-bugs] [Bug 37999] Unsequenced warnings displayed inconsistently

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jul 1 20:16:45 PDT 2018


David Blaikie <dblaikie at gmail.com> changed:

           What    |Removed                     |Added
         Resolution|---                         |INVALID
                 CC|                            |richard-llvm at metafoo.co.uk
             Status|NEW                         |RESOLVED

--- Comment #5 from David Blaikie <dblaikie at gmail.com> ---
Yep - looks like 'tolower' is implemented as a macro at -O1 and as a function
at -O0:

 g[i] = tolower(g[i++]);
 g[i] = (__extension__ ({ int __res; if (sizeof (g[i++]) > 1) { if
(__builtin_constant_p (g[i++])) { int __c = (g[i++]); __res = __c < -128 || __c
> 255 ? __c : (*__ctype_tolower_loc ())[__c]; } else __res = tolower (g[i++]);
} else __res = (*__ctype_tolower_loc ())[(int) (g[i++])]; __res; }));

So the O1 implementation doesn't have an unsequenced operation, but the O0
implementation does.

(adding Richard Smith, just in case my understanding here is wrong - I guess
maybe the statement expression might be unsequenced relative to the other parts
of the statement outside the statement expression (though the standard doesn't
talk about that, because statement expressions are non-standard))

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180702/fea43f98/attachment.html>

More information about the llvm-bugs mailing list