[Bug middle-end/117375] ICE with -fdiagnostics-details patch in sink pass when building opus-1.5.2

2024-10-31 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117375 qinzhao at gcc dot gnu.org changed: What|Removed |Added Resolution|--- |FIXED Status

[Bug middle-end/117375] ICE with -fdiagnostics-details patch in sink pass when building opus-1.5.2

2024-10-31 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117375 --- Comment #7 from qinzhao at gcc dot gnu.org --- The reason for the ICE is: The destination of the code movement due to tree sinking might not be the immediate destination block of the block in which the statement locates. for example

[Bug middle-end/117375] ICE with -fdiagnostics-details patch in sink pass when building opus-1.5.2

2024-10-30 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117375 --- Comment #6 from qinzhao at gcc dot gnu.org --- (In reply to Sam James from comment #3) > btw, I haven't tried bootstrapping with -fdiagnostics-details, but it might > be worth trying to bootstrap and regtest with a patch that does

[Bug middle-end/117375] ICE with -fdiagnostics-details patch in sink pass when building opus-1.5.2

2024-10-30 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117375 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug tree-optimization/117179] Confusing -Warray-bounds output for wget (wrong order of conditions in if statement)

2024-10-24 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117179 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||rguenther at suse dot de

[Bug tree-optimization/115274] [14/15 regression] Bogus -Wstringop-overread in SQLite source code

2024-10-24 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115274 qinzhao at gcc dot gnu.org changed: What|Removed |Added Status|ASSIGNED|NEW --- Comment #14 from

[Bug tree-optimization/115274] [14/15 regression] Bogus -Wstringop-overread in SQLite source code

2024-10-23 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115274 --- Comment #13 from qinzhao at gcc dot gnu.org --- >when adding -fno-tree-sink, the warning disappeared. Before tree-sinking optimization, the IR is: (c.151t.pre) [local count: 1073741824]: c.0_1 = c; _2 = c.0_1 + 1; _5 = strlen

[Bug tree-optimization/117179] Confusing -Warray-bounds output for wget (wrong order of conditions in if statement)

2024-10-23 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117179 --- Comment #4 from qinzhao at gcc dot gnu.org --- Looks like that my RFC patch currently has bugs that cannot locate the event accurately. need more study here to see how to locate the conditional event accurately. I need to reduce this test

[Bug tree-optimization/117180] Confusing -Warray-bounds output for Tor

2024-10-23 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117180 --- Comment #3 from qinzhao at gcc dot gnu.org --- Looks like that my RFC patch currently has bugs that cannot locate the event accurately. need more study here to see how to locate the conditional event accurately. I need to reduce this test

[Bug tree-optimization/115274] Bogus -Wstringop-overread in SQLite source code

2024-10-16 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115274 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug c/106762] incorrect array bounds warning (-Warray-bounds) at -O2 on memset()

2024-10-16 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106762 --- Comment #5 from qinzhao at gcc dot gnu.org --- with my work-in-progress patch + -fdiagnostics-explain-harder: t_106762.c: In function ‘bug’: t_106762.c:16:2: warning: ‘memset’ offset [0, 7] is out of the bounds [0, 0] [-Warray-bounds

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-10-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 qinzhao at gcc dot gnu.org changed: What|Removed |Added Resolution|--- |FIXED Status

[Bug tree-optimization/108770] [12/13/14/15 regression] Spurious -Warray-bounds at -O2 (gcc >= 12)

2024-10-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108770 --- Comment #3 from qinzhao at gcc dot gnu.org --- With my patch for new option -fdiagnostics-explain-harder, the output is: t_108770.c: In function ‘init’: t_108770.c:10:13: warning: array subscript 2 is above array bounds of ‘const char *[2

[Bug tree-optimization/85788] False positive of -Wstringop-overflow= warning

2024-10-10 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85788 --- Comment #5 from qinzhao at gcc dot gnu.org --- with my current patch to PR109071, adding -fdiagnostics-explain-harder, with an additional option -fno-tree-dominator-opts, the diagnostic becomes: t_85788.c:5:3: warning

[Bug tree-optimization/85788] False positive of -Wstringop-overflow= warning

2024-10-10 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85788 --- Comment #4 from qinzhao at gcc dot gnu.org --- (In reply to Martin Liška from comment #0) > As seen, d == 0, thus 'for (; c; c = e)' never executes. It's combination of > jump-threading and VRP that triggers the w

[Bug tree-optimization/88771] Misleading -Werror=array-bounds error

2024-10-09 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88771 --- Comment #28 from qinzhao at gcc dot gnu.org --- (In reply to qinzhao from comment #27) > Yes, I agree with Jeff. > This looks like a similar issue as PR109071. the patch that improve the diagnostic for PR109071 could also improve this one.

[Bug tree-optimization/116519] Arm64(?): undue array bounds warning

2024-10-09 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116519 --- Comment #4 from qinzhao at gcc dot gnu.org --- (In reply to qinzhao from comment #3) > The warning disappears after adding -fno-thread-jumps. > looks like similar issue as PR109071 further study turned out that: although using -fno-

[Bug c/116735] ICE in build_counted_by_ref

2024-10-07 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116735 qinzhao at gcc dot gnu.org changed: What|Removed |Added Resolution|--- |FIXED Status

[Bug sanitizer/116984] -fsanitize=bounds triggers within __builtin_dynamic_object_size()

2024-10-07 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116984 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug middle-end/116983] counted_by not used to identify singleton pointers

2024-10-07 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116983 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug middle-end/116933] various issues of -ftrivial-auto-var-init=zero with Ada

2024-10-07 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116933 --- Comment #16 from qinzhao at gcc dot gnu.org --- (In reply to Eric Botcazou from comment #12) > > We added one more argument for __builtin_clear_padding to distinguish > > whether this call is for AUTO_INIT or not. > > >

[Bug middle-end/116933] internal error on basic Ada program with -ftrivial-auto-var-init=zero

2024-10-04 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116933 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug tree-optimization/85788] False positive of -Wstringop-overflow= warning

2024-10-03 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85788 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug c/106762] incorrect array bounds warning (-Warray-bounds) at -O2 on memset()

2024-10-03 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106762 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug tree-optimization/108770] Spurious -Warray-bounds at -O2 (gcc >= 12)

2024-10-03 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108770 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug tree-optimization/116519] Arm64(?): undue array bounds warning

2024-10-03 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116519 --- Comment #3 from qinzhao at gcc dot gnu.org --- The warning disappears after adding -fno-thread-jumps. looks like similar issue as PR109071

[Bug tree-optimization/88771] Misleading -Werror=array-bounds error

2024-10-01 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88771 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug c/116735] ICE in build_counted_by_ref

2024-09-30 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116735 --- Comment #3 from qinzhao at gcc dot gnu.org --- This is a bug when handling the counted_by attribute when the corresponding field doesn't exist. under such situation, in addition to issue error, we also need to remove the added "

[Bug middle-end/116736] missing diagnostic for out-of-bounds array access

2024-09-26 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116736 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug middle-end/116736] missing diagnostic for out-of-bounds array access

2024-09-26 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116736 --- Comment #2 from qinzhao at gcc dot gnu.org --- currently, the "counted_by" info is used in __builtin_dynamic_object_size and bounds sanitizer. and expected to catch out-of-bounds access during runtime. So, this is the expected behavior.

[Bug tree-optimization/116585] [12/13/14 Regression] SSA corruption with -O3

2024-09-25 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116585 --- Comment #5 from qinzhao at gcc dot gnu.org --- (In reply to Richard Biener from comment #4) > Fixed on trunk sofar. thanks a lot for fixing this so quick. Will this patch be backported to older releases?

[Bug c/46073] __builtin_choose_expr outputs warnings for unused expression

2024-09-06 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46073 --- Comment #6 from qinzhao at gcc dot gnu.org --- (In reply to Joseph S. Myers from comment #5) > It's doubtful that this is a bug. You could define __builtin_choose_expr so > the unselected operand only needs to be a balanced tok

[Bug c/46073] __builtin_choose_expr outputs warnings for unused expression

2024-09-06 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46073 qinzhao at gcc dot gnu.org changed: What|Removed |Added Severity|minor |normal

[Bug c/46073] __builtin_choose_expr outputs warnings for unused expression

2024-09-06 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46073 --- Comment #4 from qinzhao at gcc dot gnu.org --- the adoption of the new builtin __builtin_get_counted_by (PR116016) depends on fixing this PR.

[Bug tree-optimization/116585] New: SSA corruption with -O3,-fvect-cost-model=very-cheap cures the failure

2024-09-03 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: --- This is bug we found with GCC8 for our very large application. and it can be repeated till the trunk GCC. (I can

[Bug tree-optimization/116316] incorrect code with -O2

2024-08-09 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116316 --- Comment #2 from qinzhao at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #1) > :13:6: warning: dereferencing type-punned pointer will break > strict-aliasing rules [-Wstrict-aliasing] >13 | *(size_t *)(&(ar

[Bug tree-optimization/116316] New: incorrect code with -O2

2024-08-09 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: --- the following testing case failed on both x86 and aarch64 with -O2, but passed with -O1: #include struct annotated { int b; int c[]; } *array_annotated; int main(int argc, char

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-08-07 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #61 from qinzhao at gcc dot gnu.org --- (In reply to qinzhao from comment #60) > I came up with the following draft for the documentation of the new > __builtin_get_counted_by, let me know your comments and suggestions:

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-08-07 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #60 from qinzhao at gcc dot gnu.org --- I came up with the following draft for the documentation of the new __builtin_get_counted_by, let me know your comments and suggestions: Builtin-in Function: type __builtin_get_counted_by (ptr

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-08-05 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #56 from qinzhao at gcc dot gnu.org --- https://gcc.gnu.org/pipermail/gcc-patches/2024-August/659478.html

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-08-05 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #52 from qinzhao at gcc dot gnu.org --- (In reply to Alejandro Colomar from comment #51) > I would make it a compile-time error. Why would we want to allow a non-FAM > there? (Unless the [[gnu::counted_by()]] attribute makes

[Bug testsuite/116155] c-c++-common/fam-in-union-alone-in-struct-1.c fails on pru-unknown-elf

2024-08-05 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116155 --- Comment #12 from qinzhao at gcc dot gnu.org --- (In reply to Dimitar Dimitrov from comment #11) > > With that change, the test passes for both x86 and pru. thank you for the testing. could you please prepare the patch for this and sub

[Bug testsuite/116155] c-c++-common/fam-in-union-alone-in-struct-1.c fails on pru-unknown-elf

2024-08-02 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116155 --- Comment #10 from qinzhao at gcc dot gnu.org --- (In reply to Dimitar Dimitrov from comment #9) > For pru: > sizeof (int) = 4 > __alignof__ (int) = 1 > > From gcc/config/pru.h: > #define INT_TYPE_SIZE 32 > #defin

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-08-02 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #48 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #30) > Then perhaps we should ASAP change > handle_counted_by_attribute so that it emits a sorry message if > (c_dialect_cxx ()), > either

[Bug testsuite/116155] c-c++-common/fam-in-union-alone-in-struct-1.c fails on pru-unknown-elf

2024-08-01 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116155 --- Comment #8 from qinzhao at gcc dot gnu.org --- (In reply to Dimitar Dimitrov from comment #7) > Size of only_fam_2 is 1. sizeof (int) and alignof (int) still is 4?

[Bug testsuite/116155] c-c++-common/fam-in-union-alone-in-struct-1.c fails on pru-unknown-elf

2024-08-01 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116155 --- Comment #6 from qinzhao at gcc dot gnu.org --- (In reply to Dimitar Dimitrov from comment #5) > > What fails on pru is: > if (sizeof (struct only_fam_2) != sizeof (int)) > __builtin_abort (); > > I think we need to

[Bug testsuite/116155] c-c++-common/fam-in-union-alone-in-struct-1.c fails on pru-unknown-elf

2024-08-01 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116155 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-31 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #45 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #42) > > But for the kernel you'll need to have fallback code which will set the > actual counter manually for compilers without support

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-31 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #44 from qinzhao at gcc dot gnu.org --- (In reply to uecker from comment #41) > I also do not yet understand why this feature is needed. The count should be > set anyway. Yes. But setting the count in _every_ place where a str

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-31 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #40 from qinzhao at gcc dot gnu.org --- (In reply to Bill Wendling from comment #39) > > But this all relies upon the 'counted_by' attribute existing. For this > example: > > typeof(*__builtin_ge

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-31 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #38 from qinzhao at gcc dot gnu.org --- (In reply to Bill Wendling from comment #37) > I realized my error after sending this. So yeah it's not going to work. I'm > okay with what's being discussed. I just wan

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-30 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #35 from qinzhao at gcc dot gnu.org --- (In reply to Bill Wendling from comment #33) > > We could then have a builtin to get the attribute's argument: > > __builtin_get_attr_arg (ptr, attr_name); not sure wheth

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-30 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #34 from qinzhao at gcc dot gnu.org --- (In reply to Bill Wendling from comment #33) > > If we had a way of testing for an attribute, we could avoid the need to > return ( void *)0 when the '__builtin_get' can&#

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-30 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #29 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #28) > It would need to be a FE keyword where __builtin_get_counted_by would return > some pointer, either e.g. (void *)0 if it doesn't have

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-26 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #22 from qinzhao at gcc dot gnu.org --- the following is the user documentation I came up based on all the discussion so far, let me know any comment and suggestion. (refer to GCC's __builtin_clear_padding doc on the prototype o

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-25 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #20 from qinzhao at gcc dot gnu.org --- (In reply to Bill Wendling from comment #19) > > Does it have to be a FAM? What is the problem if this is used on, e.g. an > > arbitrary pointer? > > > > IMO

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-25 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #17 from qinzhao at gcc dot gnu.org --- (continue with the comment #16): the compiler's responsibility is: A. check whether p->fam has counted-by attribute or not; B. get the corresponding counted-by field for p->fam and

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-25 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #16 from qinzhao at gcc dot gnu.org --- (In reply to Siddhesh Poyarekar from comment #15) > (In reply to qinzhao from comment #14) > > If we go with the category B (as I mentioned in Comment #9), define the new > >

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-25 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #14 from qinzhao at gcc dot gnu.org --- (In reply to Siddhesh Poyarekar from comment #13)> > Does it have to be a FAM? What is the problem if this is used on, e.g. an > arbitrary pointer? If we go with the categor

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-25 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #12 from qinzhao at gcc dot gnu.org --- (In reply to Bill Wendling from comment #10) > The Clang implementation will probably have a prototype of something like: > > void __builtin_set_counted_by(void *, size_t) >

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-25 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 qinzhao at gcc dot gnu.org changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |qinzhao at gcc dot

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-22 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #9 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #8) > It doesn't matter how it is documented, what matters is how it is > implemented. > E.g. can you do (__builtin_call_with_static_c

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-22 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #7 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #6) > That is a bad example, __builtin_call_with_static_chain is not a builtin > function, but a keyword. A little confused here, this funct

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-22 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #5 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #4) > That is not a prototype. Prototype is what is the C or C++ function type of > the builtin. Neither ptr->FAM nor const_exp_with_int_type

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-22 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug middle-end/115527] incorrect folding of __builtin_clear_padding()

2024-07-16 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115527 --- Comment #9 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #8) > (In reply to qinzhao from comment #6) > > --- a/gcc/gimple-fold.cc > > +++ b/gcc/gimple-fold.cc > > @@ -4815,6 +4815,7

[Bug middle-end/115527] -ftrivial-auto-var-init appears to clobber explicit initializer

2024-07-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115527 --- Comment #6 from qinzhao at gcc dot gnu.org --- This is a bug in gimple-fold.cc, when folding __builtin_clear_padding. The problematic code is in the routine "clear_padding_type" when the TYPE is ARRAY_TYPE. /* For su

[Bug middle-end/115527] -ftrivial-auto-var-init appears to clobber explicit initializer

2024-07-12 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115527 --- Comment #5 from qinzhao at gcc dot gnu.org --- the following code in gimple-fold.cc has issue: 4440 tree dst = build2_loc (buf->loc, MEM_REF, atype, buf->base, 4441 build_int_cst (buf->a

[Bug middle-end/115527] -ftrivial-auto-var-init appears to clobber explicit initializer

2024-07-12 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115527 --- Comment #4 from qinzhao at gcc dot gnu.org --- when checking the expanded IR for __builtin_clear_padding in the below: the builtin __builtin_clear_padding (&o, 0B); was expanded as the following sequence D.4430 = &o + 0;

[Bug middle-end/115527] -ftrivial-auto-var-init appears to clobber explicit initializer

2024-07-12 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115527 --- Comment #3 from qinzhao at gcc dot gnu.org --- I believe that this is a bug in __builtin_clear_padding. when I change the testing case to: struct inner { double a; char b; long l; }; struct outer { struct inner in_array[3

[Bug middle-end/111775] -Wstrict-flex-arrays missing diagnostics with unions

2024-06-21 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111775 qinzhao at gcc dot gnu.org changed: What|Removed |Added Status|RESOLVED|CLOSED Resolution

[Bug middle-end/111775] -Wstrict-flex-arrays missing diagnostics with unions

2024-06-21 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111775 qinzhao at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED

[Bug middle-end/115527] -ftrivial-auto-var-init appears to clobber explicit initializer

2024-06-18 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115527 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug middle-end/111775] -Wstrict-flex-arrays missing diagnostics with unions

2024-06-14 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111775 --- Comment #2 from qinzhao at gcc dot gnu.org --- (In reply to Cristian Rodríguez from comment #1) > Any hope of getting this fixed for 15? it is quite annoying when trying to > update older codebases to use c99 FAM. a slightly modified

[Bug analyzer/111567] RFE: support __attribute__((counted_by)) in -fanalyzer

2024-05-31 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111567 Bug 111567 depends on bug 108896, which changed state. Bug 108896 Summary: provide "element_count" attribute to give more context to __builtin_dynamic_object_size() and -fsanitize=bounds https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896

[Bug c/108896] provide "element_count" attribute to give more context to __builtin_dynamic_object_size() and -fsanitize=bounds

2024-05-31 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896 qinzhao at gcc dot gnu.org changed: What|Removed |Added Resolution|--- |FIXED Status

[Bug tree-optimization/109071] -Warray-bounds false positive warnings due to code duplication from jump threading

2024-05-14 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109071 --- Comment #11 from qinzhao at gcc dot gnu.org --- please see discussion at: https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651482.html A summary of the discussion: 1. The current warning is correct, which catches a potential source code

[Bug tree-optimization/109071] -Warray-bounds false positive warnings due to code duplication from jump threading

2024-05-13 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109071 --- Comment #10 from qinzhao at gcc dot gnu.org --- with the following added heuristic in array-bound checker: + /* If the stmt is duplicated and splitted, the warning level is not 2, + and the current block is not dominating the exit

[Bug c/53548] allow flexible array members in unions like zero-length arrays

2024-05-06 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53548 qinzhao at gcc dot gnu.org changed: What|Removed |Added Version|unknown |15.0 Status

[Bug tree-optimization/109071] -Warray-bounds false positive warnings due to code duplication from jump threading

2024-04-22 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109071 --- Comment #9 from qinzhao at gcc dot gnu.org --- (In reply to Kees Cook from comment #8) > Normally -Warray-bounds doesn't warn when a value is totally unknown (i.e. > "index" here can be [-INT_MAX,INT_MAX]). Why does th

[Bug tree-optimization/109071] -Warray-bounds false positive warnings due to code duplication from jump threading

2024-04-22 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109071 --- Comment #7 from qinzhao at gcc dot gnu.org --- (In reply to Kees Cook from comment #6) > (In reply to qinzhao from comment #5) > > adding __attribute__ ((noreturn)) to the routine "warn" can eliminate the > > false p

[Bug tree-optimization/109071] -Warray-bounds false positive warnings due to code duplication from jump threading

2024-04-22 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109071 --- Comment #5 from qinzhao at gcc dot gnu.org --- adding __attribute__ ((noreturn)) to the routine "warn" can eliminate the false positive warning.

[Bug c/53548] allow flexible array members in unions like zero-length arrays

2024-04-08 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53548 --- Comment #10 from qinzhao at gcc dot gnu.org --- Clang has accept this extension: https://github.com/llvm/llvm-project/pull/84428

[Bug tree-optimization/111407] [11/12/13 Regression] ICE: SSA corruption due to widening_mul opt on conflict across an abnormal edge

2024-04-02 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111407 qinzhao at gcc dot gnu.org changed: What|Removed |Added Resolution|--- |FIXED Status

[Bug target/104817] mips: ICE in mips_output_move, at config/mips/mips.cc:5323 with -fzero-call-used-regs=all

2024-03-26 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104817 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug c/53548] allow flexible array members in unions like zero-length arrays

2024-03-13 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53548 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug middle-end/111523] Unexpected performance regression with -ftrivial-auto-var-init=zero for e.g. systemctl unmask

2024-03-13 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111523 --- Comment #10 from qinzhao at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #9) > Anways systemd has now changed the buffer to 256 which is much much smaller > and for most calls enough in size before needing to realloca

[Bug c/108896] provide "element_count" attribute to give more context to __builtin_dynamic_object_size() and -fsanitize=bounds

2024-03-06 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896 --- Comment #50 from qinzhao at gcc dot gnu.org --- the 6th version of the patch sets targeted on GCC15 has been submitted to GCC alias for review: https://gcc.gnu.org/pipermail/gcc-patches/2024-February/645838.html https://gcc.gnu.org/pipermail

[Bug middle-end/111523] Unexpected performance regression with -ftrivial-auto-var-init=zero for e.g. systemctl unmask

2024-02-29 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111523 qinzhao at gcc dot gnu.org changed: What|Removed |Added CC||qinzhao at gcc dot gnu.org

[Bug tree-optimization/111407] [11/12/13 Regression] ICE: SSA corruption due to widening_mul opt on conflict across an abnormal edge

2024-02-29 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111407 --- Comment #13 from qinzhao at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #12) > (In reply to qinzhao from comment #10) > > (In reply to Andrew Pinski from comment #6) > > the fix has been in GCC14, shall we bac

[Bug tree-optimization/111407] ICE: SSA corruption due to widening_mul opt on conflict across an abnormal edge

2023-09-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111407 --- Comment #10 from qinzhao at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #6) the fix has been in GCC14, shall we backport the patch to previous releases?

[Bug tree-optimization/111407] ICE: SSA corruption due to widening_mul opt on conflict across an abnormal edge

2023-09-13 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111407 --- Comment #8 from qinzhao at gcc dot gnu.org --- the latest GCC14 has the same issue. with the patch proposed in comment #1, the failure has been fixed.

[Bug tree-optimization/111407] ICE: SSA corruption due to widening_mul opt on conflict across an abnormal edge

2023-09-13 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111407 --- Comment #7 from qinzhao at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #5) > Testcase: thanks a lot for the testing case. GCC8 failed with this, disable tree-widening_mul fixed the failure. and my patch for GCC8 also fi

[Bug tree-optimization/111407] ICE: SSA corruption due to widening_mul opt on conflict across an abnormal edge

2023-09-13 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111407 --- Comment #4 from qinzhao at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #2) > Also what target is this for? > I suspect aarch64 since x86_64 does not have widening multiply ... you are right, it's aarch64.

[Bug tree-optimization/111407] ICE: SSA corruption due to widening_mul opt on conflict across an abnormal edge

2023-09-13 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111407 --- Comment #3 from qinzhao at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #1) > Do you have a testcase? I have, but I cannot expose it to public. I can provide the Bad IR and Good IR if you think it's okay.

[Bug tree-optimization/111407] New: ICE: SSA corruption due to widening_mul opt on conflict across an abnormal edge

2023-09-13 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: --- this bug was originally reported against GCC8.5 with profiling feedback. there were multiple similar

[Bug sanitizer/102317] signed integer overflow sanitizer cannot work well with -fno-strict-overflow

2023-09-07 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102317 --- Comment #12 from qinzhao at gcc dot gnu.org --- (In reply to Kees Cook from comment #11) > The trouble with "optimize" is that it just doesn't work. The kernel has > banned its use because it results in all other optim

[Bug tree-optimization/111040] __builtin_object_size: inconsistent result for subobject with member arrays.

2023-08-18 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111040 --- Comment #3 from qinzhao at gcc dot gnu.org --- a summary of the discussion: We have two different sources to get the size information for subobjects: A. The TYPE information of the subobject in the IR; B. The initialization

[Bug tree-optimization/111040] __builtin_object_size: inconsistent result for subobject with member arrays.

2023-08-18 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111040 --- Comment #2 from qinzhao at gcc dot gnu.org --- the discussion on this bug is at: https://gcc.gnu.org/pipermail/gcc-patches/2023-August/627631.html

[Bug tree-optimization/111040] __builtin_object_size: inconsistent result for subobject with member arrays.

2023-08-16 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111040 --- Comment #1 from qinzhao at gcc dot gnu.org --- an initial study inside gdb shows the following: 1. the guilty pass is "ccp1", when folding the call to __builtin_dynamic_object_size(p->array, 1) 2. In this pass, the IR fo

  1   2   3   4   >