[Bug middle-end/66348] Simple loop never exits with -O1, exits with -O0

2021-11-29 Thread sebastiano.vigna at unimi dot it via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348 Sebastiano Vigna changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c/99623] Code behaves differently at -O2 optimization

2021-03-17 Thread sebastiano.vigna at unimi dot it via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99623 --- Comment #10 from Sebastiano Vigna --- Ahem no, my correction goes in the opposite direction it should go. I'll ask suggestions to the library authors. I really apologize for all the noise.

[Bug c/99623] Code behaves differently at -O2 optimization

2021-03-17 Thread sebastiano.vigna at unimi dot it via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99623 --- Comment #9 from Sebastiano Vigna --- Finally solved: the problematic statement if (h == NULL) h = (struct prb_node *)&tree->prb_root; should just be if (h == NULL) h = tree->prb_root->prb_link[0]; The position in memory of the two pointer

[Bug c/99623] Code behaves differently at -O2 optimization

2021-03-17 Thread sebastiano.vigna at unimi dot it via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99623 --- Comment #8 from Sebastiano Vigna --- I'm sorry, I did the test on the wrong file. No, you cannot eliminate the &, even if the type is correct, and h can be NULL at that point. I'll ask the libavl maintainers their opinion. We can compile with

[Bug c/99623] Code behaves differently at -O2 optimization

2021-03-17 Thread sebastiano.vigna at unimi dot it via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99623 Sebastiano Vigna changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c/99623] Code behaves differently at -O2 optimization

2021-03-17 Thread sebastiano.vigna at unimi dot it via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99623 --- Comment #6 from Sebastiano Vigna --- Created attachment 50410 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50410&action=edit Source

[Bug c/99623] Code behaves differently at -O2 optimization

2021-03-17 Thread sebastiano.vigna at unimi dot it via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99623 --- Comment #5 from Sebastiano Vigna --- Created attachment 50409 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50409&action=edit Source

[Bug c/99623] Code behaves differently at -O2 optimization

2021-03-17 Thread sebastiano.vigna at unimi dot it via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99623 --- Comment #2 from Sebastiano Vigna --- Created attachment 50408 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50408&action=edit Source

[Bug c/99623] Code behaves differently at -O2 optimization

2021-03-17 Thread sebastiano.vigna at unimi dot it via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99623 --- Comment #1 from Sebastiano Vigna --- Created attachment 50407 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50407&action=edit Output of gcc with -O2

[Bug c/99623] New: Code behaves differently at -O2 optimization

2021-03-17 Thread sebastiano.vigna at unimi dot it via Gcc-bugs
Assignee: unassigned at gcc dot gnu.org Reporter: sebastiano.vigna at unimi dot it Target Milestone: --- Created attachment 50406 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50406&action=edit Output of --save-temps The included code compares two variants

[Bug c/66348] Simple loop never exits with -O1, exits with -O0

2015-06-08 Thread sebastiano.vigna at unimi dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348 --- Comment #13 from Sebastiano Vigna --- I can confirm that compiling/running with ubsan and asan no problem is reported. The bug does not show up.

[Bug c/66348] Simple loop never exits with -O1, exits with -O0

2015-06-06 Thread sebastiano.vigna at unimi dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348 --- Comment #12 from Sebastiano Vigna --- BTW, to further restrict the search I'm trying to replicate the bug with -fsanitize=address, or at least to get to the problematic call under -fsanitize=address, but it'll take a while. I have to recompil

[Bug c/66348] Simple loop never exits with -O1, exits with -O0

2015-06-06 Thread sebastiano.vigna at unimi dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348 --- Comment #11 from Sebastiano Vigna --- Dear Mikhail, I have several ongoing open-source projects and, believe me, I make exactly the same recommendation to people reporting bugs. They are perfectly sensible and certainly the way to go in 99% o

[Bug c/66348] Simple loop never exit with -O1, exits with -O0

2015-06-05 Thread sebastiano.vigna at unimi dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348 --- Comment #9 from Sebastiano Vigna --- As I said, I was trying (a bit naively, admittedly) a diagnosis. I agree fully--I'm no expert in x86 assembly. But it is a fact that the problematic loop never exits with -O1, and exits normally with -O0.

[Bug c/66348] Simple loop has only lower half of the 64-bit counter initialized correctly

2015-06-05 Thread sebastiano.vigna at unimi dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348 --- Comment #7 from Sebastiano Vigna --- I tried also with -fsanitize=address. No problems reported. Bug not showing up. A classical heisenbug.

[Bug c/66348] Simple loop has only lower half of the 64-bit counter initialized correctly

2015-06-02 Thread sebastiano.vigna at unimi dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348 --- Comment #6 from Sebastiano Vigna --- I forgot an important aspect: with -fsanitize=undefined the optimization bug does not show up. The instrumentation perturbs the code enough to make it go away.

[Bug c/66348] Simple loop has only lower half of the 64-bit counter initialized correctly

2015-06-02 Thread sebastiano.vigna at unimi dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348 --- Comment #5 from Sebastiano Vigna --- Fantastic tool! I didn't know about it. But it doesn't fire. There is no undefined behaviour in that code--it's just that the optimizer at -O1 does something wrong. I tried a binary search over the singl

[Bug c/66348] Simple loop has only lower half of the 64-bit counter initialized correctly

2015-05-30 Thread sebastiano.vigna at unimi dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348 --- Comment #3 from Sebastiano Vigna --- As an additional information: we printed b->num_lines - 1 - n just before the loop, and everything is fine--we get there with the current value both with -O0 and -O1. But we -O1 we never exit the loop.

[Bug c/66348] Simple loop has only lower half of the 64-bit counter initialized correctly

2015-05-30 Thread sebastiano.vigna at unimi dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348 --- Comment #2 from Sebastiano Vigna --- Er... it's perfectly possible. My knowledge of x64 assembly is rudimentary, but I wanted to try a diagnosis. What is definitely true is that at -O0 we enter and exit the loop as it should happen, and at -

[Bug c/66348] New: Simple loop with 64-bit index has only lower half initialized correctly

2015-05-30 Thread sebastiano.vigna at unimi dot it
Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: sebastiano.vigna at unimi dot it Target Milestone: --- Created attachment 35657 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35657&action=edit Source (buffer.c) and