[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2025-02-26 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 Sam James changed: What|Removed |Added Keywords|needs-reduction | Status|UNCONFIRMED

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2025-02-24 Thread gavin at yzena dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #17 from Gavin Howard --- > These links are dead. That's why we want references to a standalone testcase > given (lines in it or functions and so on)... Fair enough, but in my defense, it's been two years. I was pretty sure this had

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2025-02-24 Thread gavin at yzena dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #19 from Gavin Howard --- Understood. If I had to guess, and this is a *wild* guess, it's because I'm putting a pointer to a function in the allocation. As far as I can tell, this is still allowed, per the docs: > Attribute `mallo

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2025-02-24 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #18 from Sam James --- That's exactly where I saw it ;) I go over bugs marked as needs-reduction/wrong-code/needs-bisection often, but this bug wasn't marked as those, so I didn't see it. WAITING means we need the reporter to give u

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2025-02-24 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #16 from Sam James --- (In reply to Gavin Howard from comment #0) > [1]: > https://git.yzena.com/Yzena/Yc/src/commit/ > 6afdc86bd2c17f98b2f9e97e79e37fdf8c6b7708/src/alloc/stackpool.c#L441 > > [2]: > https://git.yzena.com/Yzena/Yc/sr

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2025-02-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #15 from Andrew Pinski --- void* y_realloc(void* ptr, y_usize size) __attribute__((malloc)); Yes that should NOT be malloc. I wonder if removing malloc from y_realloc fixes the issue. NOTE realloc is not marked as malloc. See th

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2025-02-24 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 Sam James changed: What|Removed |Added Status|WAITING |UNCONFIRMED Keywords|

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2025-02-24 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #14 from Sam James --- Hm, dropping the attribute everywhere doesn't help.

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2025-02-24 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #11 from Sam James --- It still aborts with -O1 -fno-strict-aliasing (just to be sure, though -O1 shouldn't need it). It passes with -O1 -fno-tree-pta.

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2025-02-24 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #13 from Sam James --- (In reply to Sam James from comment #12) > I suspect this is abuse of __attribute__((malloc)). y_stackpool_malloc returns a value derived from input `p`.

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2025-02-24 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #12 from Sam James --- I suspect this is abuse of __attribute__((malloc)).

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2023-01-23 Thread gavin at yzena dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #10 from Gavin Howard --- I have confirmed that the GCC bug (if it is a bug) also exists in 12.2.1, at least using the amal.c I have attached.

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2023-01-19 Thread gavin at yzena dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #9 from Gavin Howard --- > I suspect cmake didn't add -fno-strict-aliasing really. It did. I ran the build under `intercept-build` and looked at the `compile_commands.json` output. It had the `-fno-strict-aliasing` for every file.

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2023-01-19 Thread gavin at yzena dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #8 from Gavin Howard --- Created attachment 54310 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54310&action=edit Amalgamation with License Header Not important for the bug, but I reuploaded the amalgamation with its proper l

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2023-01-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #7 from Andrew Pinski --- I do notice some aliasing violations with y_map_index and y_strucon_handleErrorHelper y_vec* stack; ... y_map_existsStringKey_v(d->contexts, ("com.yzena.yc.error_handler"),

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2023-01-18 Thread gavin at yzena dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #6 from Gavin Howard --- Created attachment 54302 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54302&action=edit An Amalgamation to Reproduce I have managed to make an amalgamation that reproduces the bug. When you unzip the

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2023-01-18 Thread gavin at yzena dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #5 from Gavin Howard --- As mentioned, it works at -O0, and UBSan reports nothing until the segfault. ASan also reports nothing. Valgrind also reports nothing. They all report nothing at -O0 and -O2. I keep my code clean of such thi

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2023-01-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #4 from Andrew Pinski --- Does it work at -O0? Does -fsanitizer=address -fsanitizer=undefined report anything?

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2023-01-18 Thread gavin at yzena dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #3 from Gavin Howard --- > Have you tried -fno-strict-aliasing ? I have a feeling like you have some > aliasing issues in this code ... Just tried it, same thing happens. I'll try to make a better test case, but in this case, the

[Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy

2023-01-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448 --- Comment #2 from Andrew Pinski --- Have you tried -fno-strict-aliasing ? I have a feeling like you have some aliasing issues in this code ...