public inbox for overseers@sourceware.org
 help / color / mirror / Atom feed
* Bug report in GCC
@ 2016-10-18 12:16 Nicolas Le Scouarnec
  0 siblings, 0 replies; only message in thread
From: Nicolas Le Scouarnec @ 2016-10-18 12:16 UTC (permalink / raw)
  To: overseers

Dear administrator,

I request an account on gcc bugzilla to submit the following bug
report about incorrect code being generated by gcc when using gcc -O2
level.

--------
In the following code, the & is incorrectly eliminated for
optimization level 2 or  on both gcc 5.3.1, gcc 6.2 with
march=haswell. It seems that it assumes that _tzcnt_u64 should always
return a value < 64, but the actual specification is that it returns
64 when l is 0.

#include <stdint.h>
#include <stdio.h>
#include <immintrin.h>

int main(int argc, char ** argv){
  unsigned long l = atol(argv[1]);
  uint32_t t = _tzcnt_u64(l) & (64u-1u);
  printf("%u\n",t);
}
-------

-- 
Nicolas Le Scouarnec

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-18 12:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-18 12:16 Bug report in GCC Nicolas Le Scouarnec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).