[Bug analyzer/115044] New: -Wanalyzer-malloc-leak diagnostic in terminal path

2024-05-11 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115044 Bug ID: 115044 Summary: -Wanalyzer-malloc-leak diagnostic in terminal path Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3

[Bug analyzer/108968] fanalyzer false positive with the uninitalised-ness of the stack pointer

2023-03-02 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108968 --- Comment #15 from Andrew Cooper --- Wow that's a lot of junk getting included for the minimal include set I could easily make. It occurs to me only after posting that you're liable to fail at: asm ( ".include

[Bug analyzer/108968] fanalyzer false positive with the uninitalised-ness of the stack pointer

2023-03-02 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108968 --- Comment #14 from Andrew Cooper --- Created attachment 54572 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54572=edit Preprocessed example

[Bug analyzer/108968] fanalyzer false positive with the uninitalised-ness of the stack pointer

2023-03-02 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108968 --- Comment #13 from Andrew Cooper --- I've constructed an example which might be the knockon effect you were worried about? void foo(char *other) { char *ptr = NULL; if ( current->domain ) ptr = other; asm volatile

[Bug analyzer/108968] fanalyzer false positive with the uninitalised-ness of the stack pointer

2023-03-02 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108968 --- Comment #10 from Andrew Cooper --- >From trying this out, a const attribute doesn't alter the code generation in the slightest, so I presume GCC has already figured the const-ness out.

[Bug analyzer/108968] fanalyzer false positive with the uninitalised-ness of the stack pointer

2023-03-02 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108968 --- Comment #9 from Andrew Cooper --- Thank-you for the fix. I've recompiled master and this uninitialised warning has gone. Unfortunately, Xen isn't GCC-13 clean (seems like a real bug in Xen), and the analyser has pointed out various other

[Bug analyzer/108968] fanalyzer false positive with the uninitalised-ness of the stack pointer

2023-02-28 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108968 --- Comment #6 from Andrew Cooper --- (In reply to David Malcolm from comment #5) > Minimal reproducer: https://godbolt.org/z/E6EEY1WT6 > > Am I right in understanding that: > register unsigned long sp asm("rsp"); > is intended as a way to

[Bug c/108968] fanalyzer false positive with the uninitalised-ness of the stack pointer

2023-02-28 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108968 Andrew Cooper changed: What|Removed |Added Component|analyzer|c --- Comment #4 from Andrew Cooper

[Bug c/108968] fanalyzer false positive with the uninitalised-ness of the stack pointer

2023-02-28 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108968 --- Comment #2 from Andrew Cooper --- __builtin_frame_address() does appear to resolve the warning, but the knock-on effect for code generation is even worse than the asm() block. It forces a frame-pointer setup in all functions that use it

[Bug c/108968] New: fanalyzer false positive with the uninitalised-ness of the stack pointer

2023-02-28 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108968 Bug ID: 108968 Summary: fanalyzer false positive with the uninitalised-ness of the stack pointer Product: gcc Version: 13.0 Status: UNCONFIRMED Severity:

[Bug middle-end/108799] Improper deprecation diagnostic for rsp clobber

2023-02-15 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108799 --- Comment #2 from Andrew Cooper --- Adding a memory clobber doesn't make any difference that I can see, and I'm not aware of any reason why it ought to make a difference. I suppose that my real request here is to figure out what is the

[Bug c/108799] New: Improper deprecation diagnostic for rsp clobber

2023-02-15 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108799 Bug ID: 108799 Summary: Improper deprecation diagnostic for rsp clobber Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3

[Bug middle-end/104971] [9/10/11/12 Regression] Optimisation for __builtin_ia32_readeflags corrupts the stack

2022-03-17 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104971 --- Comment #3 from Andrew Cooper --- So yes - my experimentation did start from investigating the memory ordering behaviour of these builtins, based on a thread on LKML. The pushf in readflags and popf in writeflags have wildly different

[Bug middle-end/104971] New: Optimisation for __builtin_ia32_readeflags corrupts the stack

2022-03-17 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104971 Bug ID: 104971 Summary: Optimisation for __builtin_ia32_readeflags corrupts the stack Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal

[Bug target/104816] -fcf-protection=branch should generate endbr instead of notrack jumps

2022-03-07 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104816 --- Comment #7 from Andrew Cooper --- (In reply to H.J. Lu from comment #5) > Are you suggesting to add an option to generate jump table with ENDBR? Jump tables are a legitimate optimisation. NOTRACK is a weakness in CET protections, and

[Bug target/104816] -fcf-protection=branch should generate endbr instead of notrack jumps

2022-03-07 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104816 --- Comment #4 from Andrew Cooper --- I've worked around this in Xen with: https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=9d4a44380d273de22d5753883cbf5581795ff24d and

[Bug target/102953] Improvements to CET-IBT and ENDBR generation

2022-02-23 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102953 --- Comment #25 from Andrew Cooper --- (In reply to H.J. Lu from comment #24) > (In reply to Andrew Cooper from comment #23) > > Apologies for the delay, but I do now have a working prototype of Xen with > > CET-IBT active, using the current

[Bug target/102952] New code-gen options for retpolines and straight line speculation

2022-02-07 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952 --- Comment #40 from Andrew Cooper --- I've given the GCC-11 branch a test and everything appears to be in order.

[Bug target/102952] New code-gen options for retpolines and straight line speculation

2022-01-06 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952 --- Comment #33 from Andrew Cooper --- Looks good to me

[Bug target/102952] New code-gen options for retpolines and straight line speculation

2022-01-06 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952 --- Comment #30 from Andrew Cooper --- (In reply to CVS Commits from comment #27) > > x86: Add -mharden-sls=[none|all|return|indirect-branch] > It occurs to me that `indirect-branch` needs renaming to be `indirect-jmp` as the logic

[Bug target/102953] Improvements to CET-IBT and ENDBR generation

2021-11-05 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102953 --- Comment #23 from Andrew Cooper --- Apologies for the delay, but I do now have a working prototype of Xen with CET-IBT active, using the current version of these patches. The result actually builds back to older versions of GCCs, but the

[Bug target/102953] Improvements to CET-IBT and ENDBR generation

2021-10-29 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102953 --- Comment #21 from Andrew Cooper --- Another possibly-bug, but possibly mis-expectations on my behalf. I've found some code in the depths of Xen which is causing a failure on final link due to a missing `__x86_indirect_thunk_nt_rax` symbol.

[Bug target/102953] Improvements to CET-IBT and ENDBR generation

2021-10-29 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102953 --- Comment #20 from Andrew Cooper --- (In reply to H.J. Lu from comment #19) > (In reply to Andrew Cooper from comment #17) > > I think I've found a bug in the -fcf-check-attribute implementation. > > Please try the v5 patch. Thanks. That

[Bug target/102953] Improvements to CET-IBT and ENDBR generation

2021-10-29 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102953 --- Comment #17 from Andrew Cooper --- I think I've found a bug in the -fcf-check-attribute implementation. $ cat fnptr-array-arg.c static int __attribute__((cf_check)) foo(char a[], int b) { return 0; } int (*ptr)(char[], int)

[Bug target/102952] New code-gen options for retpolines and straight line speculation

2021-10-28 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952 --- Comment #22 from Andrew Cooper --- One curious thing I have discovered. While auditing the -mharden-sls=all code generation in Xen, I found examples where I got "ret int3 ret int3" with no intervening instructions. It turns out this is

[Bug target/102953] Improvements to CET-IBT and ENDBR generation

2021-10-28 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102953 --- Comment #14 from Andrew Cooper --- (In reply to H.J. Lu from comment #13) > (In reply to Andrew Cooper from comment #11) > > > > There should be a diagnostic, but it ought to include cf_check in the type > > it prints. > > Try the v3

[Bug target/102953] Improvements to CET-IBT and ENDBR generation

2021-10-28 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102953 --- Comment #11 from Andrew Cooper --- (In reply to H.J. Lu from comment #10) > (In reply to Andrew Cooper from comment #8) > > Actually, there is a (possibly pre-existing) diagnostics issue: > > > > $ cat proto.c > > static void

[Bug target/102953] Improvements to CET-IBT and ENDBR generation

2021-10-27 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102953 --- Comment #8 from Andrew Cooper --- Actually, there is a (possibly pre-existing) diagnostics issue: $ cat proto.c static void __attribute__((cf_check)) foo(void); static void __attribute__((unused)) foo(void) { } void (*ptr)(void) = foo; $

[Bug target/102952] New code-gen options for retpolines and straight line speculation

2021-10-27 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952 --- Comment #18 from Andrew Cooper --- Yes to both.

[Bug target/102952] New code-gen options for retpolines and straight line speculation

2021-10-27 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952 --- Comment #15 from Andrew Cooper --- So this is the irritating corner case where the two options are linked. *If* we are using -mindirect-branch-cs-prefix, then we intend to rewrite `jmp __x86_indirect_thunk_*` to `jmp *%reg` or `lfence; jmp

[Bug c/102967] confusing location in -Waddress for a subexpression of a ternary expression

2021-10-27 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102967 --- Comment #2 from Andrew Cooper --- (In reply to Martin Sebor from comment #1) > The warning is intended: it points out that the second operand of the > conditional expression is necessarily true: > > if ( !(pa ? >c : NULL) ) >

[Bug target/102953] Improvements to CET-IBT and ENDBR generation

2021-10-27 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102953 --- Comment #7 from Andrew Cooper --- Thankyou. I've tried these two patches and they do appear to be behaving as intended. I've put together a slightly extended version of the original test. Compile with gcc -Wall -fno-pic -Os

[Bug c/102967] New: -Waddress with nested structures: Incorrect "the comparison will always evaluate as 'true'"

2021-10-27 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102967 Bug ID: 102967 Summary: -Waddress with nested structures: Incorrect "the comparison will always evaluate as 'true'" Product: gcc Version: 12.0 Status: UNCONFIRMED

[Bug target/102952] New code-gen options for retpolines and straight line speculation

2021-10-26 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952 --- Comment #2 from Andrew Cooper --- PeterZ has suggested that the straight line speculation case can be dis-entangled with the thunk inlining case. If an `int3` is emitted following any `jmp __x86_indirect_thunk_*` instruction (i.e. treated

[Bug c/102953] New: Improvements to CET-IBT and ENDBR generation

2021-10-26 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102953 Bug ID: 102953 Summary: Improvements to CET-IBT and ENDBR generation Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component:

[Bug c/102952] New code-gen options for retpolines and straight line speculation

2021-10-26 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952 --- Comment #1 from Andrew Cooper --- https://bugs.llvm.org/show_bug.cgi?id=52323 for Clang cross-request.

[Bug c/102952] New: New code-gen options for retpolines and straight line speculation

2021-10-26 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952 Bug ID: 102952 Summary: New code-gen options for retpolines and straight line speculation Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal

[Bug middle-end/99578] gcc-11 -Warray-bounds or -Wstringop-overread warning when accessing a pointer from integer literal

2021-05-19 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 --- Comment #15 from Andrew Cooper --- (In reply to Martin Sebor from comment #1) > For now, I recommend suppressing the warning either by #pragma GCC > diagnostic or by making the pointer volatile. Trying this with the code sample from comment

[Bug middle-end/99578] gcc-11 -Warray-bounds or -Wstringop-overread warning when accessing a pointer from integer literal

2021-05-19 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 Andrew Cooper changed: What|Removed |Added CC||andrew.cooper3 at citrix dot com ---