missed PTA optimization?

2020-02-11 Thread Uecker, Martin
In the following example, it seems that 'bar' could be optimized to return '1' and every else could be optimized away. Or am I missing something? Do I need to add some specific compiler flags? static int a = 1; static int *p; extern void foo(void) {   p = &a; } extern int bar(void) {   retu

Re: missed PTA optimization?

2020-02-11 Thread Uecker, Martin
Am Dienstag, den 11.02.2020, 21:43 +0100 schrieb Richard Biener: > On February 11, 2020 9:32:14 PM GMT+01:00, "Uecker, Martin" > > wrote: > > > > In the following example, it seems > > that 'bar' could be optimized to > > return '1&#x

atomic_load: code generation 64 bit for struct

2020-06-28 Thread Uecker, Martin
Hi all, the following code compiles into a mov instruction on x86_64. I wonder why. The struct has alignment 4, so a mov might not be atomic if the struct is not alligned to its full size. For this reason, I expected a call to libatomic instead  (LLVM does this). What am I missing? The docume

VLA warning on recent git

2020-10-23 Thread Uecker, Martin
I tested a recent GCC from git and noticed a couple of new warnings for VLA parameters. (Martin, I assume this is your work. First, let me say: thank you! I think this is really important.) Here is some feedback from running this on an existing code base. See below for comments and toy example

Re: Re: typeof and operands in named address spaces

2020-11-15 Thread Uecker, Martin
> On Wed, Nov 04, 2020 at 07:31:42PM +0100, Uros Bizjak wrote: > > Hello! > >  > > I was looking at the recent linux patch series [1] where segment > > qualifiers (named address spaces) were introduced to handle percpu > > variables. In the patch [2], the author mentions that: > >  > > --q-- > > U

Re: Re: typeof and operands in named address spaces

2020-11-16 Thread Uecker, Martin
Am Montag, den 16.11.2020, 12:10 +0100 schrieb Peter Zijlstra: > ( restoring at least linux-toolcha...@vger.kernel.org, since that > seems > to have gone missing ) > > On Mon, Nov 16, 2020 at 10:11:50AM +0100, Richard Biener wrote: > > On Sun, Nov 15, 2020 at 11

Re: Re: typeof and operands in named address spaces

2020-11-17 Thread Uecker, Martin
Am Dienstag, den 17.11.2020, 11:31 -0800 schrieb Linus Torvalds: > On Tue, Nov 17, 2020 at 11:25 AM Jakub Jelinek wrote: > > > > It would need to be typeof( (typeof(type)) (type) ) to not be that > > constrained on what kind of expressions it accepts as arguments. > > Yup. > > > Anyway, it won'

Re: C provenance semantics proposal

2019-04-17 Thread Uecker, Martin
Hi Richard, Am Mittwoch, den 17.04.2019, 11:41 +0200 schrieb Richard Biener: > On Wed, Apr 17, 2019 at 11:15 AM Peter Sewell > wrote: > > > > On 17/04/2019, Richard Biener wrote: > > > On Fri, Apr 12, 2019 at 5:31 PM Peter Sewell > > > wrote: ... > > > So this is not what GCC implements whi

Re: C provenance semantics proposal

2019-04-17 Thread Uecker, Martin
Am Mittwoch, den 17.04.2019, 14:41 +0200 schrieb Richard Biener: > On Wed, Apr 17, 2019 at 1:53 PM Uecker, Martin > wrote: > > > > >  Since > > > your proposal is based on an abstract machine there isn't anything > > > like a pointer with mult

Re: C provenance semantics proposal

2019-04-17 Thread Uecker, Martin
Am Mittwoch, den 17.04.2019, 15:34 +0200 schrieb Richard Biener: > On Wed, Apr 17, 2019 at 2:56 PM Uecker, Martin > wrote: > > > > Am Mittwoch, den 17.04.2019, 14:41 +0200 schrieb Richard Biener: > > > On Wed, Apr 17, 2019 at 1:53 PM Uecker, Martin > > &g

Re: C provenance semantics proposal

2019-04-18 Thread Uecker, Martin
Am Donnerstag, den 18.04.2019, 11:56 +0200 schrieb Richard Biener: > On Thu, Apr 18, 2019 at 11:31 AM Richard Biener > wrote: > > > > On Wed, Apr 17, 2019 at 4:12 PM Uecker, Martin > > wrote: > > > > > > Am Mittwoch, den 17.04.2019, 15:34 +0200 schr

Re: C provenance semantics proposal

2019-04-18 Thread Uecker, Martin
Am Donnerstag, den 18.04.2019, 11:45 +0100 schrieb Peter Sewell: > On Thu, 18 Apr 2019 at 10:32, Richard Biener > wrote: > An equality test of two pointers, on the other hand, doesn't necessarily > mean that they are interchangeable.  I don't see any good way to > avoid that in a provenance sem

Re: C provenance semantics proposal

2019-04-18 Thread Uecker, Martin
Am Donnerstag, den 18.04.2019, 14:30 +0200 schrieb Richard Biener: > On Thu, Apr 18, 2019 at 1:57 PM Uecker, Martin > wrote: > > > > Am Donnerstag, den 18.04.2019, 11:56 +0200 schrieb Richard Biener: > > > On Thu, Apr 18, 2019 at 11:31 AM Richard Biener > >

Re: C provenance semantics proposal

2019-04-18 Thread Uecker, Martin
Am Donnerstag, den 18.04.2019, 14:42 +0200 schrieb Richard Biener: > On Thu, Apr 18, 2019 at 2:20 PM Uecker, Martin > wrote: > > > > Am Donnerstag, den 18.04.2019, 11:45 +0100 schrieb Peter Sewell: > > > On Thu, 18 Apr 2019 at 10:32, Richard Biener > > > wro

Re: C provenance semantics proposal

2019-04-18 Thread Uecker, Martin
Am Donnerstag, den 18.04.2019, 07:42 -0600 schrieb Jeff Law: > On 4/18/19 6:20 AM, Uecker, Martin wrote: > > Am Donnerstag, den 18.04.2019, 11:45 +0100 schrieb Peter Sewell: > > > On Thu, 18 Apr 2019 at 10:32, Richard Biener > > > wrote: ... > > 4.) Compile

Re: C provenance semantics proposal

2019-04-18 Thread Uecker, Martin
Am Donnerstag, den 18.04.2019, 15:49 +0100 schrieb Peter Sewell: > On Thu, 18 Apr 2019 at 14:54, Uecker, Martin > wrote: > > > > Am Donnerstag, den 18.04.2019, 07:42 -0600 schrieb Jeff Law: > > > On 4/18/19 6:20 AM, Uecker, Martin wrote: > > > > Am Donnerst

Re: C provenance semantics proposal

2019-04-19 Thread Uecker, Martin
Am Freitag, den 19.04.2019, 10:19 +0200 schrieb Jens Gustedt: > Hello, > > On Thu, 18 Apr 2019 14:42:22 +0200 Richard Biener > wrote: > > > On Thu, Apr 18, 2019 at 2:20 PM Uecker, Martin > > wrote: > > > 1.) Compilers do not use conditional equivalences for

Re: C provenance semantics proposal

2019-04-19 Thread Uecker, Martin
Am Freitag, den 19.04.2019, 10:35 +0100 schrieb Peter Sewell: > On 19/04/2019, Jens Gustedt wrote: > > Hello Peter, > > > > On Fri, 19 Apr 2019 10:11:43 +0100 Peter Sewell > > wrote: > > > > > On 19/04/2019, Jakub Jelinek wrote: > > > > On Fri, Apr 19, 2019 at 10:19:28AM +0200, Jens Gustedt wr

Re: C provenance semantics proposal

2019-04-24 Thread Uecker, Martin
Am Mittwoch, den 24.04.2019, 21:30 +0200 schrieb Philipp Klaus Krause: > Am 24.04.19 um 20:41 schrieb Jeff Law: > > > > > 4.) Compilers make sure that exposed objects never > > > > > are allocated next to each other (as Jens proposed). > > > > > > > > Ugh.  Not sure how you enforce that.  Consider

compatibility of structs/unions/enums in the middle end

2019-10-01 Thread Uecker, Martin
Hi, I have a proposal for making changes to the rules for compatibility of tagged types in C2X  (N2366). This was received with interest by WG14, so there is a chance that this could get accepted into C2X. In particular, the idea is to make structs (+ unions, enums) with the same tag and the sa

Re: compatibility of structs/unions/enums in the middle end

2019-10-02 Thread Uecker, Martin
Am Mittwoch, den 02.10.2019, 12:47 +0200 schrieb Richard Biener: > On Wed, Oct 2, 2019 at 12:46 PM Richard Biener > wrote: > > > > On Tue, Oct 1, 2019 at 7:49 PM Uecker, Martin > > wrote: ... > > > > > > In particular, the idea is to make structs (+

Re: compatibility of structs/unions/enums in the middle end

2019-10-02 Thread Uecker, Martin
Am Mittwoch, den 02.10.2019, 14:18 +0200 schrieb Richard Biener: > On Wed, Oct 2, 2019 at 1:57 PM Uecker, Martin > wrote: > > Thank you for your answers. > > Finally, how does LTO does it? It somehow also needs to unify > > different tagged types? Could we reus

Re: compatibility of structs/unions/enums in the middle end

2019-10-02 Thread Uecker, Martin
Am Mittwoch, den 02.10.2019, 15:12 +0200 schrieb Richard Biener: > On Wed, Oct 2, 2019 at 3:10 PM Richard Biener > wrote: > > > > On Wed, Oct 2, 2019 at 2:35 PM Uecker, Martin > > wrote: > > > > > > Am Mittwoch, den 02.10.2019, 14:18 +0200 schrieb Rich

Re: compatibility of structs/unions/enums in the middle end

2019-10-02 Thread Uecker, Martin
Am Mittwoch, den 02.10.2019, 17:37 +0200 schrieb Richard Biener: > On October 2, 2019 3:55:43 PM GMT+02:00, "Uecker, Martin" > > wrote: > > Am Mittwoch, den 02.10.2019, 15:12 +0200 schrieb Richard Biener: > > > On Wed, Oct 2, 2019 at 3:10 PM Richard Biener &g

Re: compatibility of structs/unions/enums in the middle end

2019-10-04 Thread Uecker, Martin
Am Freitag, den 04.10.2019, 12:29 +0200 schrieb Richard Biener: > On Wed, Oct 2, 2019 at 8:24 PM Uecker, Martin > wrote: > > > > Am Mittwoch, den 02.10.2019, 17:37 +0200 schrieb Richard Biener: > > > > ... > > > > > > > Oh, and LT

Re: compatibility of structs/unions/enums in the middle end

2019-10-04 Thread Uecker, Martin
Am Freitag, den 04.10.2019, 14:28 +0200 schrieb Richard Biener: > On Fri, Oct 4, 2019 at 1:55 PM Uecker, Martin > wrote: > > > > Am Freitag, den 04.10.2019, 12:29 +0200 schrieb Richard Biener: > > > On Wed, Oct 2, 2019 at 8:24 PM Uecker, Martin > > > wrot

pointers to variable-length arrays - undefined behavior sanitizer

2018-03-27 Thread Uecker, Martin
Hi, I want to add run-time support for checking for equality of the size expressions where pointers to variable-length arrays are required to be compatible. I wonder if you could give some advise on how to approach this. One general question is where this should be added. For example, I think it

TBAA

2021-05-15 Thread Uecker, Martin
Hi Richard, I noticed that GCC 11 has different behavior in the following example relative to 10.2 with -O2. I wonder whether this is an intentional change and if yes, what are the rules? Thanks! Martin https://godbolt.org/z/57res7ax1 #include #include __attribute__((__noinline__, __weak_

Re: TBAA

2021-05-17 Thread Uecker, Martin
Am Montag, den 17.05.2021, 09:08 +0200 schrieb Richard Biener: > On Sun, May 16, 2021 at 8:57 AM Uecker, Martin > wrote: > > > > > > Hi Richard, > > > > I noticed that GCC 11 has different behavior in the following > > example relative to 10.2

Re: TBAA

2021-05-17 Thread Uecker, Martin
Am Montag, den 17.05.2021, 09:44 +0200 schrieb Richard Biener: > On Mon, May 17, 2021 at 9:32 AM Uecker, Martin > wrote: > > > > > > Am Montag, den 17.05.2021, 09:08 +0200 schrieb Richard Biener: > > > On Sun, May 16, 2021 at 8:57 AM Uecker, Martin > >

safety command-line options

2021-05-24 Thread Uecker, Martin
I wonder if we could get a nice short command-line option for recommended safety/security related flags. We have -Ox for optimization and -Wall for a useful set of recommended warnings. I am thinking about options such as -ftrapv -fsanitize=undefined -fsanitize-undefined-trap-on-error -fstack

TBAA bug?

2021-07-25 Thread Uecker, Martin
Hi Richard, here is another case where it seems that TBAA goes wrong. Since this is not in a loop, it seems this is something else than what we discussed. Is this a known issue? Best, Martin #include #include union u { long x; long long y; }; __attribute__((noinline,noclone)) long tes

Re: [PATCH] Various pages: SYNOPSIS: Use VLA syntax in function parameters

2022-11-29 Thread Uecker, Martin
Am Dienstag, dem 29.11.2022 um 14:58 + schrieb Michael Matz: > Hey, > > On Tue, 29 Nov 2022, Alex Colomar via Gcc wrote: > > > How about the compiler parsing the parameter list twice? > > This _is_ unbounded look-ahead.  You could avoid this by using "." > for > your new syntax.  Use someth

Re: [PATCH] Various pages: SYNOPSIS: Use VLA syntax in function parameters

2022-11-29 Thread Uecker, Martin
Hi, Am Dienstag, dem 29.11.2022 um 15:44 + schrieb Michael Matz: > Hey, > > On Tue, 29 Nov 2022, Uecker, Martin wrote: > > > It does not require any changes on how arrays are represented. > > > > As part of VM-types the size becomes part of the type and this