public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104551] New: Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids
@ 2022-02-15 18:01 vsevolod.livinskij at frtk dot ru
  2022-02-15 23:21 ` [Bug tree-optimization/104551] [12 Regression] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vsevolod.livinskij at frtk dot ru @ 2022-02-15 18:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104551
           Summary: Wrong code with -O3 for skylake-avx512,
                    icelake-server, and sapphirerapids
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vsevolod.livinskij at frtk dot ru
  Target Milestone: ---

Reproducer (I was not able to merge it into a single file):
// func.cpp
extern unsigned var_11, var_178;
extern unsigned char arr_492[];
void test() {
  for (bool a = 0; a < (bool)var_11; a = 2)
    for (unsigned b = 0; b < var_11;
         b += 1)
      var_178 = arr_492[b] ? arr_492[b] : (char) b;
}

// driver.cpp 
unsigned int var_11 = 16U;
unsigned int var_178 = 0;
unsigned char arr_492 [16];

void test();

int main() {
    for (int i = 0; i < 16; ++i)
        arr_492 [i] = (unsigned char)128;
    test();
    __builtin_printf("%u\n", var_178);
    if (var_178 != 128)
        __builtin_abort();
    return 0;
}

Error:
>$ g++ -O0 func.cpp driver.cpp -march=skylake-avx512 && sde -skx -- ./a.out 
128
>$ g++ -O3 func.cpp driver.cpp -march=skylake-avx512 && sde -skx -- ./a.out 
4294967168
Aborted (core dumped)

g++ (git://gcc.gnu.org/git/gcc.git:master
58aeb75d4097010ad9bb72b964265b18ab284f93) 12.0.1 20220213 (experimental)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-18  0:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15 18:01 [Bug tree-optimization/104551] New: Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids vsevolod.livinskij at frtk dot ru
2022-02-15 23:21 ` [Bug tree-optimization/104551] [12 Regression] " pinskia at gcc dot gnu.org
2022-02-16  1:52 ` crazylht at gmail dot com
2022-02-16  2:34 ` crazylht at gmail dot com
2022-02-16  3:57 ` crazylht at gmail dot com
2022-02-17 11:01 ` cvs-commit at gcc dot gnu.org
2022-02-17 11:02 ` crazylht at gmail dot com
2022-02-18  0:37 ` pinskia at gcc dot gnu.org

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).