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

2021-09-13 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

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

2021-09-13 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102317 --- Comment #2 from qinzhao at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #1) > -fno-strict-overflow maps directly to -fwrapv . > > If you want to use -fsanitize=signed-integer-overflow, you can just remove > both

[Bug tree-optimization/102359] ICE gimplification failed since r12-3433-ga25e0b5e6ac8a77a

2021-09-29 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102359 --- Comment #2 from qinzhao at gcc dot gnu.org --- (In reply to Richard Biener from comment #1) > Confirmed. So we end with '&__closure->__this' which indeed isn't an lvalue. > > The issue here is that we are

[Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c

2021-09-29 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 --- Comment #8 from qinzhao at gcc dot gnu.org --- the ICE is triggered by the following IR: MEM[(int[0:D.1993] *)&fb.3] = .DEFERRED_INIT (16, 2, 1); which is transformed from the original IR: (*fb.1_9) = .DEFERRED_INIT (16, 2, 1);

[Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c

2021-09-30 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 --- Comment #9 from qinzhao at gcc dot gnu.org --- the direct cause of the ICE is because: MEM[(int[0:D.1993] *)&fb.3] = .DEFERRED_INIT (16, 2, 1); in the above, the fb.3 is in REG instead MEM: 8451 gcc_assert (MEM_P (re

[Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c

2021-09-30 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 --- Comment #10 from qinzhao at gcc dot gnu.org --- commented the following transformation in tree-ssa-ccp.c: 2733 #if 0 2734 /* The heuristic of fold_builtin_alloca_with_align differs before and 2735after inlining, so we

[Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c

2021-09-30 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 --- Comment #12 from qinzhao at gcc dot gnu.org --- with the following change, I can resolve the ICE: [opc@qinzhao-ol8u3-x86 gcc]$ git diff diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 70ce6a4d5b8d..b07026165075 100644 --- a/gcc

[Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c

2021-10-01 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 --- Comment #15 from qinzhao at gcc dot gnu.org --- (In reply to Richard Biener from comment #13) > Because the variable doesn't need to be addressable. > > OK, so the issue is likely that we're probing the lhs with EXPAND_

[Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c

2021-10-01 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 --- Comment #17 from qinzhao at gcc dot gnu.org --- > > OK, so the issue is likely that we're probing the lhs with EXPAND_WRITE but > > when we expand the memset we end up with using expand_expr_addr_expr_1 > > with EX

[Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c

2021-10-01 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 --- Comment #18 from qinzhao at gcc dot gnu.org --- (In reply to Richard Biener from comment #13) > We could try sth like the following which should cover this testcase and > also hopefully doesn't break anything else. > >

[Bug tree-optimization/102587] ICE in tree_to_uhwi, at tree.h:4668

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

[Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c

2021-10-04 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 --- Comment #25 from qinzhao at gcc dot gnu.org --- (In reply to Richard Biener from comment #22) > Hmm, my proposed patch seems to work. I've adjusted it to not regress > previously correctly handled cases and will test it fully.

[Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c

2021-10-04 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 --- Comment #26 from qinzhao at gcc dot gnu.org --- (In reply to qinzhao from comment #25) > (In reply to Richard Biener from comment #22) > > Hmm, my proposed patch seems to work. I've adjusted it to not regress > >

[Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c

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

[Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c

2021-10-04 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 --- Comment #28 from qinzhao at gcc dot gnu.org --- (In reply to Richard Biener from comment #21) > Reduced testcase: > > int > qy (void) > { > int tw = 4; > int fb[tw]; > return fb[2]; > } For this reduced tes

[Bug tree-optimization/102359] ICE gimplification failed since r12-3433-ga25e0b5e6ac8a77a

2021-10-05 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102359 qinzhao at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED

[Bug c++/102281] -ftrivial-auto-var-init=zero causes ice

2021-10-11 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102281 --- Comment #7 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #2) > __builtin_clear_padding when folded emits a series of memory stores rather > than BIT_INSERT_EXPR etc., so that wouldn't work. &g

[Bug c++/102281] -ftrivial-auto-var-init=zero causes ice

2021-10-12 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102281 --- Comment #11 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #8) > Sure, you can, but just note that it is conservative and fast, it will > return true even for types that don't have any padding. >

[Bug c++/102281] -ftrivial-auto-var-init=zero causes ice

2021-10-12 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102281 --- Comment #12 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #8) > and if you have a variable that isn't addressable, you need to figure out > what to do. I think it might be easiest not to clear anythi

[Bug c++/102281] -ftrivial-auto-var-init=zero causes ice

2021-10-13 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102281 --- Comment #14 from qinzhao at gcc dot gnu.org --- All the 3 testing cases can be resolved by adding the following patch (check whether the type has padding before adding call to __builtin_clear_padding): I believe that this is a safe partial

[Bug middle-end/102781] New: -ftrivial-auto-var-init might not clear paddings for long double/_Complex long double variables that have explicit initializer

2021-10-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: ---

[Bug middle-end/102781] -ftrivial-auto-var-init might not clear paddings for long double/_Complex long double variables that have explicit initializer

2021-10-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102781 --- Comment #1 from qinzhao at gcc dot gnu.org --- This is a placeholder to an known issue with -ftrivial-auto-var-init: If a long double/_Complex long double auto variable has explicit initializer, and when this variable is spilled into stack

[Bug c++/102281] -ftrivial-auto-var-init=zero causes ice

2021-10-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102281 --- Comment #15 from qinzhao at gcc dot gnu.org --- A summary of this bug based on discussion and more study: multiple issues in the current implemenation: A. should check is_gimple_reg before adding the call to __builtin_clear_padding

[Bug c++/102281] -ftrivial-auto-var-init=zero causes ice

2021-10-25 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102281 --- Comment #16 from qinzhao at gcc dot gnu.org --- Created attachment 51662 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51662&action=edit proposed patch to gcc12

[Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken

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

[Bug c++/102281] -ftrivial-auto-var-init=zero causes ice

2021-11-01 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102281 --- Comment #18 from qinzhao at gcc dot gnu.org --- fixed

[Bug c++/102281] -ftrivial-auto-var-init=zero causes ice

2021-11-01 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102281 qinzhao at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED

[Bug middle-end/107411] trivial-auto-var-init=zero invalid uninitialized variable warning

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

[Bug middle-end/106123] ICE in walk_tree_1, at tree.cc:11243

2022-11-08 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106123 --- Comment #2 from qinzhao at gcc dot gnu.org --- simplified testing case: [opc@qinzhao-ol8u3-x86 106123]$ cat t.C struct T { T () {}; virtual ~T () {}; int t; }; struct S : virtual public T { int a; void foo (); }; template struct U { U

[Bug middle-end/106123] ICE in walk_tree_1, at tree.cc:11243

2022-11-09 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106123 --- Comment #3 from qinzhao at gcc dot gnu.org --- the minimized testing case: struct S { int t; int a; void foo (); }; void S::foo () { #pragma omp parallel { #pragma omp taskloop firstprivate (a) for (int i = 0; i < a

[Bug c/107951] Invalid flexible array use not detected in nested structs by the C frontend

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

[Bug c/107951] Invalid flexible array use not detected in nested structs by the C frontend

2022-12-02 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107951 --- Comment #6 from qinzhao at gcc dot gnu.org --- after reading the history, my understanding is: this gcc extension is added as a workaround to build glibc since glibc source code has such usage of flexible array members; my question is

[Bug c/107951] Invalid flexible array use not detected in nested structs by the C frontend

2022-12-02 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107951 --- Comment #8 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #7) > > Because after all those years, you don't really know if it is just glibc > (which likely doesn't do that anymore), but many ot

[Bug rtl-optimization/108132] New: Wrong instruction scheduling around function call with longjmp on aarch64 at O2

2022-12-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
Severity: major Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: --- The error only happens on aarch64 (fine on X86). The following testing case: [opc@qinzhao-aarch64-ol8]$ cat

[Bug rtl-optimization/108132] Wrong instruction scheduling around function call with longjmp on aarch64 at O2

2022-12-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108132 --- Comment #1 from qinzhao at gcc dot gnu.org --- As we checked the assembly and the IR, the wrong transformation is something like the following at source code level: (inside function "main") from : a=f(a); b

[Bug rtl-optimization/108132] Wrong instruction scheduling around function call with longjmp on aarch64 at O2

2022-12-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108132 qinzhao at gcc dot gnu.org changed: What|Removed |Added Priority|P3 |P2 --- Comment #2 from

[Bug rtl-optimization/108132] Wrong instruction scheduling around function call with longjmp on aarch64 at O2

2022-12-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108132 qinzhao at gcc dot gnu.org changed: What|Removed |Added Last reconfirmed||2022-12-15 Ever

[Bug c/94428] Reintroduce -Wzero-length-array

2022-12-20 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94428 --- Comment #4 from qinzhao at gcc dot gnu.org --- a new warning -Wstrict-flex-arrays was added to gcc13. when using -Wstrict-flex-arrays -fstrict-flex-arrays=3 together, the new warning will report any misuse of zero-length arrays as flexible

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-12-21 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #43 from qinzhao at gcc dot gnu.org --- the related patch list for this work is (gcc13) 2a27ae32fabf85685758459d7ec284ccb95a 710c9676520dfd38b4bfdcc937ce026ed89921d6 ace0ae09332bbc6b95e084c2c2b17c466339ff76

[Bug target/101891] Adjust -fzero-call-used-regs to always use XOR

2022-05-05 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101891 qinzhao at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |13.0

[Bug target/101891] Adjust -fzero-call-used-regs to always use XOR

2022-05-09 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101891 --- Comment #3 from qinzhao at gcc dot gnu.org --- fixed in gcc13.

[Bug middle-end/105539] -ftrivial-auto-var-init=zero happening too late?

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

[Bug middle-end/105539] -ftrivial-auto-var-init=zero happening too late?

2022-05-10 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105539 --- Comment #6 from qinzhao at gcc dot gnu.org --- (In reply to qinzhao from comment #5) > I am a little confused: > > with gcc -Wuninitialized -O1 (without -ftrivial-auto-var-init=zero), there > are two issues: > > 1. the e

[Bug target/101891] Adjust -fzero-call-used-regs to always use XOR

2022-05-24 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101891 qinzhao at gcc dot gnu.org changed: What|Removed |Added Status|ASSIGNED|RESOLVED

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

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

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-05-27 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #8 from qinzhao at gcc dot gnu.org --- (In reply to Siddhesh Poyarekar from comment #7) > I couldn't work on -fstrict-flex-arrays then, sorry. I do have it in my > plan for gcc 13, but I'll admit it's not on th

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-06-08 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #12 from qinzhao at gcc dot gnu.org --- In the current tree-object-size.cc, "addr_object_size", it's clearly state the following: 607 /* For &X->fld, compute object size only if f

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-06-08 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #14 from qinzhao at gcc dot gnu.org --- (In reply to Kees Cook from comment #13) > Maybe the enum needs to also be expanded so that [0] can be distinguished > from []? I believe that the IR for real flexible array [] is dif

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-06-10 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #15 from qinzhao at gcc dot gnu.org --- the following patch will fix the issue with this testing case: [opc@qinzhao-ol8u3-x86 gcc]$ git diff diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc index 5ca87ae3504

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-06-10 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #16 from qinzhao at gcc dot gnu.org --- additional work are needed in order to make this task complete: 1. add one more new gcc option: -fstrict-flex-arrays when it's on, only treat the following cases as flexing array: tra

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-06-14 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #25 from qinzhao at gcc dot gnu.org --- So, based on all the discussion so far, how about the following: ** add the following gcc option: -fstrict-flex-arrays=[0|1|2|3] when -fstrict-flex-arrays=0: treat all trailing arrays as

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-06-14 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #29 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #28) > (In reply to Qing Zhao from comment #27) > > > Wouldn't this be -fno-strict-flex-arrays, i.e. the current behaviour? > >

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-06-27 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #32 from qinzhao at gcc dot gnu.org --- (In reply to James Y Knight from comment #31) > It doesn't make sense to have a mode in which `int array[0]` is accepted but > is not a flex array. > > Either that should

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-07-06 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #35 from qinzhao at gcc dot gnu.org --- (In reply to James Y Knight from comment #33) > > I don't understand what the -Wstrict-flex-arrays warning and its multiple > levels is proposed to actually do. > > Is it

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-07-06 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #38 from qinzhao at gcc dot gnu.org --- (In reply to James Y Knight from comment #37) > (In reply to qinzhao from comment #35) > > I think that -Wstrict-flex-arrays will need to be cooperated with > > -fstrict-fle

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-07-06 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #39 from qinzhao at gcc dot gnu.org --- (In reply to Siddhesh Poyarekar from comment #23) > Also I wonder if there should be an analogous -Wstrict-flex-arrays to issue > warnings alongside changing codegen. please take a l

[Bug target/106270] New: [Aarch64] -mlong-calls should be provided on aarch64 for users with large applications

2022-07-12 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: --- Created attachment 53291 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53291&action=edit tar b

[Bug target/106270] [Aarch64] -mlong-calls should be provided on aarch64 for users with large applications

2022-07-12 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106270 --- Comment #1 from qinzhao at gcc dot gnu.org --- from Jose Marchesi: We looked at this issue and these are our findings. - When this problem happens: When the linker (ld) fails to insert a veneer (that transforms the immediate bl

[Bug middle-end/101586] New: ICE:in clear_padding_type, at gimple-fold.c:4783 with call to __builtin_clear_padding for C++

2021-07-22 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: --- gcc12 failed with the following small testing case: namespace std { inline namespace __cxx11

[Bug middle-end/101586] ICE:in clear_padding_type, at gimple-fold.c:4783 with call to __builtin_clear_padding for C++

2021-07-23 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101586 --- Comment #4 from qinzhao at gcc dot gnu.org --- I applied the attached patch and tested CPU2017 with -ftrivial-auto-var-init=pattern, now all the corresponding C++ failures get resolved.

[Bug middle-end/101586] ICE:in clear_padding_type, at gimple-fold.c:4783 with call to __builtin_clear_padding for C++

2021-07-23 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101586 --- Comment #5 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #2) > Reduced testcase: > struct A { char a; }; > struct B : virtual A {}; > struct C : B {}; > > void > foo () > { > C c;

[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 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 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-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/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 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 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 tree-optimization/101832] __builtin_object_size(P->M, 1) where M ends with a flex-array behaves like sizeof()

2023-07-19 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101832 --- Comment #14 from qinzhao at gcc dot gnu.org --- since it's opened again GCC12, the patch need to be backported to GCC12. then will be closed at that time.

[Bug tree-optimization/111030] New: tree-object-size: incorrect sub-object size for VLA

2023-08-15 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: --- current __builtin_dynamic_object_size cannot handle VLA correctly for the sub-object size, please see the following testing case: #include #include

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

2023-08-16 Thread qinzhao at gcc dot gnu.org via Gcc-bugs
: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: --- __bos produces different results for subobject with different optimizations: #include #include #define

[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

[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-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 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/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 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] 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 #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 #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-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 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-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 #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-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-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 #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 #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 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 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 --- 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 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-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 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 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 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-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-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 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 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

<    1   2   3   4   >