[Bug middle-end/109557] __builtin_dynamic_object_size() does not work for simple testing case

2023-07-17 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109557 --- Comment #8 from qinzhao at gcc dot gnu.org --- with the following slightly modified testing case, the same issue: #include #include struct P { int k; int x[10]; } *p; void store(int a, int b) { p = (struct P *)malloc (sizeof

[Bug middle-end/109557] __builtin_dynamic_object_size() does not work for simple testing case

2023-04-19 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109557 --- Comment #7 from qinzhao at gcc dot gnu.org --- Okay, thanks for the comment. I see why this should not work.

[Bug middle-end/109557] __builtin_dynamic_object_size() does not work for simple testing case

2023-04-19 Thread siddhesh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109557 Siddhesh Poyarekar changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug middle-end/109557] __builtin_dynamic_object_size() does not work for simple testing case

2023-04-19 Thread muecker at gwdg dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109557 --- Comment #5 from Martin Uecker --- (In reply to Siddhesh Poyarekar from comment #4) > (In reply to Martin Uecker from comment #3) > > I general the pointer could point to the first object of an array that has > > more elements, or to an

[Bug middle-end/109557] __builtin_dynamic_object_size() does not work for simple testing case

2023-04-19 Thread siddhesh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109557 --- Comment #4 from Siddhesh Poyarekar --- (In reply to Martin Uecker from comment #3) > I general the pointer could point to the first object of an array that has > more elements, or to an object of a different type. How so? p in comment 0

[Bug middle-end/109557] __builtin_dynamic_object_size() does not work for simple testing case

2023-04-19 Thread muecker at gwdg dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109557 Martin Uecker changed: What|Removed |Added CC||muecker at gwdg dot de --- Comment #3

[Bug middle-end/109557] __builtin_dynamic_object_size() does not work for simple testing case

2023-04-19 Thread siddhesh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109557 --- Comment #2 from Siddhesh Poyarekar --- (In reply to qinzhao from comment #0) > I am wondering for > p.3_1 = p; > _2 = __builtin_object_size (p.3_1, 0); > > why the size of p.3_1 cannot use the TYPE_SIZE of the pointee of p when its > size

[Bug middle-end/109557] __builtin_dynamic_object_size() does not work for simple testing case

2023-04-19 Thread siddhesh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109557 --- Comment #1 from Siddhesh Poyarekar --- The __bdos call itself cannot succeed in main() because it cannot see the allocation in store(). One way it could succeed is if store() was inlined, but for some reason it doesn't, even if you make