public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/98069] New: Miscompilation with -O3
@ 2020-11-30 15:04 vsevolod.livinskij at frtk dot ru
  2020-11-30 16:29 ` [Bug tree-optimization/98069] [8/9/10/11 Regression] Miscompilation with -O3 since r8-2380-g2d7744d4ef93bfff marxin at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: vsevolod.livinskij at frtk dot ru @ 2020-11-30 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98069
           Summary: Miscompilation with -O3
           Product: gcc
           Version: 11.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:
//func.cpp
extern long long var_3;
extern short var_8;
extern int var_17;
extern short arr_165[];
long c(long e, long f) { return f ? e : f; }
void test() {
    for (int b = 0; b < 19; b = var_17)
        for (int d = int(~c(-2147483647 - 1, var_3)) - 2147483647; d < 22; d++)
            arr_165[d] = var_8;
}

//driver.cpp 
#include <stdio.h>

long long int var_3 = -166416893043554447LL;
short var_8 = (short)27092;
unsigned int var_17 = 75036300U;
short arr_165[23];

void test();

int main() {
    for (size_t i_3 = 0; i_3 < 23; ++i_3)
        arr_165[i_3] = (short)-8885;
    test();
    printf("%d\n", arr_165[0]);
}

>$ g++ -O3 func.cpp driver.cpp && ./a.out
Segmentation fault (core dumped)
>$ g++ -O2 func.cpp driver.cpp && ./a.out
27092

gcc version 11.0.0 20201126 (beb9afcaf1466996a301c778596c5df209e7913c)

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

end of thread, other threads:[~2023-07-07  9:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30 15:04 [Bug tree-optimization/98069] New: Miscompilation with -O3 vsevolod.livinskij at frtk dot ru
2020-11-30 16:29 ` [Bug tree-optimization/98069] [8/9/10/11 Regression] Miscompilation with -O3 since r8-2380-g2d7744d4ef93bfff marxin at gcc dot gnu.org
2020-11-30 16:29 ` marxin at gcc dot gnu.org
2020-12-01  8:33 ` rguenth at gcc dot gnu.org
2020-12-01  8:33 ` rguenth at gcc dot gnu.org
2020-12-01  9:41 ` rguenth at gcc dot gnu.org
2020-12-02  8:38 ` rguenth at gcc dot gnu.org
2020-12-04 13:23 ` rguenth at gcc dot gnu.org
2021-01-08 14:39 ` rguenth at gcc dot gnu.org
2021-04-23  9:20 ` [Bug tree-optimization/98069] [8/9/10 " rsandifo at gcc dot gnu.org
2021-04-23  9:21 ` rsandifo at gcc dot gnu.org
2021-04-23  9:21 ` rsandifo at gcc dot gnu.org
2022-06-28 10:42 ` [Bug tree-optimization/98069] [10 " jakub at gcc dot gnu.org
2023-07-07  9:15 ` rguenth 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).