[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type

2018-05-11 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 --- Comment #16 from Marc Glisse --- (patch should use 'fn && DECL_CONSTRUCTOR_P (fn)' since fn can be NULL) As I was half expecting, messing with the types that directly doesn't work. It means 'this' has type T*restrict, and if I try for instan

[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type

2018-05-11 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 Marc Glisse changed: What|Removed |Added Attachment #44112|0 |1 is obsolete|

[Bug tree-optimization/85757] tree optimizers fail to fully clean up fixed-size memcpy

2018-05-12 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85757 Marc Glisse changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed|

[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type

2018-05-12 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 --- Comment #19 from Marc Glisse --- (In reply to rguent...@suse.de from comment #18) > I suppose this changes debug information? Yes. Probably not so bad, but indeed better if we can avoid it. > I think adjusting the only user in tree-ssa-stru

[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type

2018-05-12 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 --- Comment #20 from Marc Glisse --- Created attachment 44122 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44122&action=edit untested middle-end patch This works on the testcase, I need to add a comment and run it through the testsuite.

[Bug tree-optimization/85758] questionable bitwise folding (missing single use check?)

2018-05-12 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85758 --- Comment #1 from Marc Glisse --- Direct translation would be (from clang): andl%ecx, %edx addl%edx, %edi xorl%ecx, %edx addl%edx, %esi With -mbmi, I get andn%ecx, %edx, %eax

[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type

2018-05-14 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 --- Comment #22 from Marc Glisse --- (In reply to rguent...@suse.de from comment #21) > Note that in the strict C semantic thing __restrict on > this isn't valid as the following is valid C++: > > Foo() __restrict > { > Foo *x = this; > x->a

[Bug target/85791] multiply overflow (128 bit)

2018-05-15 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85791 --- Comment #4 from Marc Glisse --- (In reply to Ruslan Nikolaev from comment #0) > 2. unsigned long long func(unsigned long long a, unsigned long long b) > { > __uint128_t c = (__uint128_t) a * b; > if (c > (unsigned long long) -

[Bug rtl-optimization/85811] Invalid optimization with fmax, fabs and nan

2018-05-16 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85811 --- Comment #1 from Marc Glisse --- tree_binary_nonnegative_warnv_p for RDIV_EXPR does RECURSE (op0) && RECURSE (op1), but that doesn't work so well when the denominator can be 0. I guess it is still ok when finite-math-only (or no-nans and no-si

[Bug rtl-optimization/85811] Invalid optimization with fmax, fabs and nan

2018-05-16 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85811 --- Comment #6 from Marc Glisse --- What does tree_expr_nonnegative_p call non-negative? A natural definition would exclude NaN, but for REAL_CST we just return ! REAL_VALUE_NEGATIVE.

[Bug tree-optimization/63185] Improve DSE with branches

2018-05-17 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63185 --- Comment #7 from Marc Glisse --- This PR is messy. To sum up, comment #0 was recently fixed, comment #5 is not (not noticing that the writes in the loop are dead), and comment #6 asks for increasing the alignment of VLAs the same way we someti

[Bug tree-optimization/85822] [8/9 Regression] Maybe wrong code in VRP since r249150

2018-05-17 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85822 --- Comment #1 from Marc Glisse --- _2 = x.0_1 & -281474976710656; if (_2 == -281474976710656) goto ; [20.24%] [...] x.0_11 = ASSERT_EXPR ; x.0_12 = ASSERT_EXPR ; x.0_13 = ASSERT_EXPR = -1>; y_7 = (unsigned intD.9) x.0_13; Thos

[Bug tree-optimization/63185] Improve DSE with branches

2018-05-18 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63185 --- Comment #12 from Marc Glisse --- (In reply to Richard Biener from comment #11) > I guess you meant (notice the bogus memset size above): True. And while it shouldn't make a difference in checking if the stores to c are dead, it could (but do

[Bug c++/85827] false positive for -Wunused-but-set-variable because of constexpr-if

2018-05-18 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85827 --- Comment #2 from Marc Glisse --- I think that's going to be hard. The same issue always existed with macros. The whole point of "if constexpr" is not to look at the other branches, as they may not even compile. Sure, some minimal "safe" attemp

[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type

2018-05-18 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 --- Comment #24 from Marc Glisse --- Author: glisse Date: Fri May 18 22:21:20 2018 New Revision: 260383 URL: https://gcc.gnu.org/viewcvs?rev=260383&root=gcc&view=rev Log: Aliasing 'this' in a C++ constructor 2018-05-18 Marc Glisse P

[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type

2018-05-18 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 Marc Glisse changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Bug c/85850] [9.0 Regression] gcc 9.0 doesn't compile with Xcode 9.3.1

2018-05-20 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85850 --- Comment #1 from Marc Glisse --- In libcpp/system.h, is included too late, after messing with macros, it should move earlier with the other includes. We could probably also avoid #defining true/false in C++ (just a warning).

[Bug middle-end/85929] _GLIBCXX_ASSERTIONS, subscript type mismatch, and std::vector bounds check elimination

2018-05-25 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85929 --- Comment #1 from Marc Glisse --- With size_type = unsigned long, the bounds check turns out to be exactly the same test as the loop exit check, and FRE3 gets rid of it. With size_type = unsigned int, it is harder. We have roughly long int

[Bug tree-optimization/85929] _GLIBCXX_ASSERTIONS, subscript type mismatch, and std::vector bounds check elimination

2018-05-28 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85929 --- Comment #4 from Marc Glisse --- (In reply to Richard Biener from comment #2) > So somehow we need to enhance the code in VRP that registers additional > asserts to also handle symbolic ranges and thus register not only > i_4 < count_8 but als

[Bug c/85974] Failure to optimize difference of two pointers into a compile time constant

2018-05-29 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85974 --- Comment #1 from Marc Glisse --- In match.pd (simplify - (pointer_diff (convert?@2 @0) (convert?@3 ADDR_EXPR@1)) + (pointer_diff (convert?@2 @0) (convert1?@3 ADDR_EXPR@1)) (that is, we can have only one cast, not just 0 or 2) and similarly

[Bug middle-end/85992] Invalid optimization with atanf

2018-05-30 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85992 --- Comment #3 from Marc Glisse --- (In reply to Matt Peddie from comment #2) > Is there a way to disable this behavior? -fno-builtin (or a more specific -fno-builtin-atanf) tells gcc to handle atanf as a regular function call, not as a standard

[Bug libstdc++/86013] std::vector::shrink_to_fit() could sometimes use realloc()

2018-06-01 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86013 --- Comment #5 from Marc Glisse --- (In reply to Jan Kratochvil from comment #0) > Maybe it could even always call realloc() for size reduction of any type of > objects and just assert the returned pointer did not change. I can't find anywhere a

[Bug libstdc++/86023] New: Fake triviality test for internal purposes

2018-06-01 Thread glisse at gcc dot gnu.org
Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- While we cannot make std::pair or std::tuple trivial for now for ABI reasons, it should still be safe to use memcpy-type

[Bug tree-optimization/86024] New: Missed memcpy loop distribution with elementwise copy

2018-06-01 Thread glisse at gcc dot gnu.org
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- typedef struct A { int a, b; } A; void*f(A*restrict p){ A*q=__builtin_malloc(1024*sizeof(A)); for(int i=0;i<1

[Bug tree-optimization/86050] Inline break tail-call optimization

2018-06-04 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86050 Marc Glisse changed: What|Removed |Added Keywords||missed-optimization Component|mid

[Bug tree-optimization/86062] New: Missed redundancy elimination with struct and array

2018-06-05 Thread glisse at gcc dot gnu.org
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- #include struct I { double i,s; I(double d):i(d),s(d){} }; typedef std::array P; typedef std::array AP; static AP c

[Bug tree-optimization/86062] Missed redundancy elimination with struct and array

2018-06-06 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86062 --- Comment #4 from Marc Glisse --- Thanks!

[Bug tree-optimization/86024] Missed memcpy loop distribution with elementwise copy

2018-06-08 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86024 --- Comment #2 from Marc Glisse --- (In reply to Richard Biener from comment #1) > Or we may want to un-"SRA" such patterns, generating aggregate copies. I notice that store-merging does not merge these stores, I didn't check why. SLP can do it

[Bug c/86092] global constant pointer optimization

2018-06-08 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86092 --- Comment #4 from Marc Glisse --- (In reply to Srinivas Achary from comment #2) > Is there any possibility to make this code work, Remove the 'const', or add 'volatile'. > without changing the variable attribute. -O0 > GCC-4 has no issue wi

[Bug c/86093] New: volatile ignored on pointer in C

2018-06-08 Thread glisse at gcc dot gnu.org
Component: c Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- extern char*volatile i; int f(){return i-i;} gets simplified in C as 1 load and return 0. In C++ or if i has a non-pointer type (say int), we do have 2 loads and

[Bug middle-end/86122] [8/9 Regression] ICE in useless_type_conversion_p, at gimple-expr.c:87

2018-06-14 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86122 --- Comment #5 from Marc Glisse --- (In reply to Jakub Jelinek from comment #2) > if we want unsigned_type_for to support complex integer types or not. I think we do (seems super easy). Testing utype can't hurt indeed. (In reply to Jakub Jeline

[Bug c++/86173] New: Default construction of a union (in std::optional)

2018-06-16 Thread glisse at gcc dot gnu.org
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- Default construction of std::optional always starts with a memset of the whole optional to 0, while it doesn't with clang usin

[Bug libstdc++/80335] perf of copying std::optional

2018-06-16 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80335 Marc Glisse changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Bug c++/86173] Default construction of a union (in std::optional)

2018-06-16 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86173 --- Comment #1 from Marc Glisse --- Note that constructing optional from std::nullopt does avoid the memset.

[Bug c++/85867] Subscript operator applied to an temporary array results in an lvalue

2018-06-16 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85867 Marc Glisse changed: What|Removed |Added CC||zhonghao at pku dot org.cn --- Comment #3

[Bug c++/86187] Subscript operator applied to an temporary array results in an lvalue

2018-06-16 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86187 Marc Glisse changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c++/86173] Default construction of a union (in std::optional)

2018-06-20 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86173 --- Comment #4 from Marc Glisse --- Recent related commits: r261758 r261735 (they don't fix the issue).

[Bug tree-optimization/86270] Simple loop needs an extra register and an extra instruction

2018-06-21 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86270 --- Comment #2 from Marc Glisse --- :-( So many transforms seem to have this kind of drawback... We could always add a pair of single_use checks, but we are going to miss some optimizations if we do that. Maybe it is slightly relevant that one +1

[Bug middle-end/86284] Insert trap instruction in place of missing return statement on dodgy code

2018-06-23 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86284 --- Comment #1 from Marc Glisse --- -fsanitize=return ?

[Bug tree-optimization/86259] [8/9 Regression] min(4, strlen(s)) optimized to strlen(s) with -flto

2018-06-24 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86259 --- Comment #15 from Marc Glisse --- (In reply to Martin Sebor from comment #14) > > You say that > > > > struct { int a; int b; } s, s2; > > memcpy (&s2.a, &s.a, sizeof (s)); > > > > is invalid, aka not copying the whole structure since you

[Bug c++/86347] Incorrect call order of allocation function in new expression

2018-06-28 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86347 Marc Glisse changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill

[Bug tree-optimization/91201] [7~9 Regression] SIMD not generated for horizontal sum of bytes in array

2019-07-18 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91201 --- Comment #1 from Marc Glisse --- We unroll the loop (-fdisable-tree-cunrolli) and SLP does not handle reductions.

[Bug c++/91217] Returning std::array from lambda results in an extra copy step on return

2019-07-21 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91217 Marc Glisse changed: What|Removed |Added Keywords||missed-optimization --- Comment #2 from Ma

[Bug tree-optimization/91227] pointer relational expression not folded but equivalent inequality is

2019-07-22 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91227 --- Comment #1 from Marc Glisse --- > if (p >= a || p <= a + 3) I think you mean &&. I believe we could fold it to true or false as we wish: false because the preexisting pointer cannot point to a local object, true because you are only allowe

[Bug tree-optimization/91227] pointer relational expression not folded but equivalent inequality is

2019-07-24 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91227 --- Comment #6 from Marc Glisse --- When we compare p>=a where a is an array (char a[3];), we can assume that p points somewhere into the array and fold it to true (unless we decide that it is too risky, and that for instance since we allow point

[Bug tree-optimization/91227] pointer relational expression not folded but equivalent inequality is

2019-07-24 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91227 --- Comment #9 from Marc Glisse --- (In reply to Martin Sebor from comment #8) > I also agree that diagnosing all these unspecified (or undefined in C) cases > would be helpful as they (at least in the straightforward instances) are > most likely

[Bug tree-optimization/91227] pointer relational expression not folded but equivalent inequality is

2019-07-26 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91227 --- Comment #12 from Marc Glisse --- (In reply to Florian Weimer from comment #11) > GCC on ELF provides defined address ordering for separate objects via linker > ordering and section attributes. I think part of these extensions is that > it is

[Bug c++/91270] ice during GIMPLE pass: dce

2019-07-27 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91270 Marc Glisse changed: What|Removed |Added Keywords||ice-on-valid-code --- Comment #1 from Marc

[Bug c++/91271] class template specialization on std::array failed

2019-07-27 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91271 --- Comment #1 from Marc Glisse --- std::array uses size_t, not int, as second parameter. I didn't check what the standard says about this.

[Bug libstdc++/78713] [missed optimization] gcc doesn't use clobbers to optimize constructors

2019-07-28 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78713 Marc Glisse changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill

[Bug libstdc++/91281] New: std::optional debug checks

2019-07-28 Thread glisse at gcc dot gnu.org
: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- std::optional::operator* has a precondition _M_engaged, but it is not checked, even in debug mode. It seems like a cheap and easy test to add.

[Bug tree-optimization/91227] pointer relational expression not folded but equivalent inequality is

2019-07-29 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91227 --- Comment #14 from Marc Glisse --- (In reply to Florian Weimer from comment #13) > I don't see why I cast should magically fix this issue, In libstdc++, std::less does such a cast, there were discussions about it at that time.

[Bug tree-optimization/91201] [7/8/9/10 Regression] SIMD not generated for horizontal sum of bytes in array

2019-07-29 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91201 --- Comment #5 from Marc Glisse --- It looks like a convoluted way to write: unsigned char sum() { unsigned char res=0; unsigned char*p=(unsigned char*)bytes; for(int n=0;n

[Bug tree-optimization/91201] [7/8/9/10 Regression] SIMD not generated for horizontal sum of bytes in array

2019-07-30 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91201 --- Comment #9 from Marc Glisse --- (In reply to Jakub Jelinek from comment #7) > Untested patch to add the reduc_plus_scal_v{16,32,64}qi expanders. > Wonder if we don't need also reduc_plus_scal_v8qi expander for > TARGET_MMX_WITH_SSE. I was ev

[Bug tree-optimization/91201] [7/8/9/10 Regression] SIMD not generated for horizontal sum of bytes in array

2019-07-30 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91201 --- Comment #10 from Marc Glisse --- For AVX512, I wonder if we could use vpsadbw to compute the sums for each 64-bit part, then vcompressb to collect them in the lower 64 bits, then vpsadbw to conclude. Or whatever other faster variant (is Peter

[Bug tree-optimization/91201] [7/8/9/10 Regression] SIMD not generated for horizontal sum of bytes in array

2019-07-30 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91201 --- Comment #12 from Marc Glisse --- (In reply to Jakub Jelinek from comment #11) > I'm not aware of vcompressb insn, only vcompressps and vcompresspd. Intel lists it under VBMI2, so icelake+. > Sure, > one could just emit whatever we emit for

[Bug c++/91317] [7/8/9/10 Regression] false-positive maybe-uninitialized warning in destructor with placement new

2019-07-31 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91317 --- Comment #1 from Marc Glisse --- Did you consider exceptions? a() could throw.

[Bug tree-optimization/91326] VRP does not handle array value range

2019-08-02 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91326 --- Comment #1 from Marc Glisse --- For bar, we don't take advantage of the uninitialized variable enough, we still have "a_3(D) == 0" at expansion time (RTL gets rid of it, but too conservatively). For foo, indeed computing the min and max valu

[Bug rtl-optimization/91333] New: [9/10 Regression] suboptimal register allocation for inline asm

2019-08-02 Thread glisse at gcc dot gnu.org
Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- Target: x86_64-*-* static double g(double x){ asm volatile("":"+x&q

[Bug c/91348] Missed optimization: not passing hidden pointer but copying memory

2019-08-04 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91348 --- Comment #1 from Marc Glisse --- NRVO happens in the C++ front-end, but not the C one, and the general tree-nrv.c is rather limited.

[Bug c++/91351] [9/10 Regression] -fstrict-enums generates incorrect code

2019-08-05 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91351 Marc Glisse changed: What|Removed |Added CC|glisse at gcc dot gnu.org | --- Comment #3 from Marc Glisse

[Bug c/91312] -Wconversion warning with += operator

2019-08-05 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91312 --- Comment #8 from Marc Glisse --- We know that the warning is not so useful as is, that's why it isn't part of Wall or Wextra, see the other bugs on the topic. It needs people with time and motivation to work on it.

[Bug c/91373] gcc6.2.0: ((U32)((U16 * U16)) >> 31) cannot always get correct result with gcc -O2

2019-08-06 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91373 --- Comment #5 from Marc Glisse --- Note that gcc (like clang) provides a tool to help you detect this kind of issue. If you compile with -fsanitize=undefined, then at runtime you will see: main.c:7:20: runtime error: signed integer overflow: 631

[Bug libstdc++/91356] Poor optimization of calls involving std::unique_ptr

2019-08-06 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91356 --- Comment #3 from Marc Glisse --- (In reply to Niels Möller from comment #2) > (In reply to Jonathan Wakely from comment #1) > > The ABI dictates the calling conventions and there's certainly nothing that > > libstdc++ can do about it. > > My

[Bug tree-optimization/91351] [9/10 Regression] -fstrict-enums generates incorrect code

2019-08-06 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91351 --- Comment #8 from Marc Glisse --- (In reply to Martin Liška from comment #7) > --- a/gcc/tree.c > +++ b/gcc/tree.c > @@ -11926,7 +11926,7 @@ int_cst_value (const_tree x) > tree > signed_or_unsigned_type_for (int unsignedp, tree type) > { > -

[Bug libstdc++/91281] std::optional debug checks

2019-08-06 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91281 Marc Glisse changed: What|Removed |Added Status|NEW |WAITING --- Comment #2 from Marc Glisse -

[Bug libstdc++/91281] std::optional debug checks

2019-08-06 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91281 Marc Glisse changed: What|Removed |Added Status|WAITING |RESOLVED Resolution|---

[Bug libstdc++/91356] Poor optimization of calls involving std::unique_ptr

2019-08-06 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91356 --- Comment #7 from Marc Glisse --- (In reply to Jonathan Wakely from comment #6) > libstdc++ would not take > advantage of it because it would break the library's stable ABI. There is always this mode (is it _GLIBCXX_INLINE_VERSION? I thought I

[Bug tree-optimization/91351] [9/10 Regression] -fstrict-enums generates incorrect code

2019-08-06 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91351 --- Comment #10 from Marc Glisse --- (In reply to Martin Liška from comment #9) > So the integer_type of the enumeral_type hash precision:5 and: > min > > and > > max > > which is what one would expect from -fstrict-enums. But the enum type

[Bug libstdc++/91356] Poor optimization of calls involving std::unique_ptr

2019-08-06 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91356 --- Comment #9 from Marc Glisse --- (In reply to Jonathan Wakely from comment #8) > you'd still need a change to the Itanium ABI. Or an attribute like [[clang::trivial_abi]], or the one that p1029 is trying to standardize. But since we would nee

[Bug c++/91383] C++17 should remove some library feature deprecated in C++14

2019-08-06 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91383 --- Comment #1 from Marc Glisse --- > "may fail to compile" we don't have to remove them, keeping them is actually on purpose so it is easier for users to have access to new features without breaking the old ones. What we could do is use the dep

[Bug middle-end/91358] Wrong code with dynamic allocation and optional like class

2019-08-07 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91358 --- Comment #5 from Marc Glisse --- (In reply to Richard Biener from comment #4) > I guess valgrind could be improved to check > only at uses of the uninit value? It is used. In the easy case it would be used in "undef & 0", so the result does n

[Bug c++/91382] Missing pedwarn when using [[maybe_unused]] in C++14

2019-08-07 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91382 --- Comment #2 from Marc Glisse --- (In reply to Jakub Jelinek from comment #1) > Aren't unknown attributes supposed to be ignored? Bug 86368 is related to that point.

[Bug c++/91397] -Wstringop-overflow specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807

2019-08-08 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91397 --- Comment #2 from Marc Glisse --- if (g == 0) return (char *)malloc(0); for (;;) ; so the only way this can return is if g is 0. This means that in j, k is -1, and you are calling memcpy with a huge argu

[Bug c++/91397] -Wstringop-overflow specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807

2019-08-08 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91397 --- Comment #4 from Marc Glisse --- I guess it happens in some dead path that gcc doesn't know is dead. At some point, you look at last_slash-path+1. Here there is a branch on whether this number is 0, and if it is 0, nonsense happens (writing 0

[Bug c++/91397] -Wstringop-overflow specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807

2019-08-08 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91397 --- Comment #5 from Marc Glisse --- mem_strdupl calls allocate(len+1). If len+1 is 0, you proceed to write to s[len] i.e. 0[-1]. I think gcc would be happier if you handled this special case explicitly (you could error, trap, just assume it canno

[Bug c++/91397] -Wstringop-overflow specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807

2019-08-08 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91397 --- Comment #7 from Marc Glisse --- (In reply to Steinar H. Gunderson from comment #6) > So basically GCC is worried that I might be calling allocate() with -1 > bytes, and gives a warning? Yes, although it might not always give the warning, dep

[Bug tree-optimization/91425] Ordered compares aren't optimised

2019-08-12 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91425 --- Comment #2 from Marc Glisse --- I think part of the problem with the current or_comparison optimization is that it relies on invert_tree_comparison in many cases, and that doesn't really work for floating point (and we handle the unsafe flags

[Bug tree-optimization/91425] Ordered compares aren't optimised

2019-08-12 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91425 --- Comment #7 from Marc Glisse --- (In reply to Segher Boessenkool from comment #6) > Maybe we should make "is this an ordered comparison" separate from the > actual comparison code. I was considering having a single .IFN_FENV_CMP (a, b, opts)

[Bug c/91432] gcc -Wimplicit-fallthrough does not warn when fallthrough to break;

2019-08-13 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432 --- Comment #1 from Marc Glisse --- The warning basically says "you may have forgotten 'break;'". If it falls through to break anyway, what difference does it make if I add a redundant break?

[Bug tree-optimization/91435] New: Better induction variable for vectorization

2019-08-13 Thread glisse at gcc dot gnu.org
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- Target: x86_64-*-* (from https://stackoverflow.com/q/57465290/1918193) long RegularTest(int n) { long sum = 0

[Bug tree-optimization/91435] Better induction variable for vectorization

2019-08-13 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91435 --- Comment #1 from Marc Glisse --- (In reply to Marc Glisse from comment #0) > If we are only ever going to use x+2, why not use that instead, initialize > with {2,3,4,...}, and skip the +2 at every iteration? Or since we have another variable

[Bug middle-end/91623] [7/8/9 Regression] -msse4.1 -O3 segfault in /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/smmintrin.h:270:10

2019-08-31 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91623 Marc Glisse changed: What|Removed |Added Keywords||ice-on-valid-code Status|UNCON

[Bug middle-end/91623] [7/8/9 Regression] -msse4.1 -O3 segfault in /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/smmintrin.h:270:10

2019-09-01 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91623 --- Comment #6 from Marc Glisse --- For the missed constant folding, it seems that we end up in fold_vec_perm, with type a vector of "long long", while arg0 and arg1 are vectors of "long", and we give up because of the early check "TREE_TYPE (TRE

[Bug tree-optimization/91645] Missed optimization with sqrt(x*x)

2019-09-04 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91645 --- Comment #3 from Marc Glisse --- (In reply to Richard Biener from comment #1) > for y >= 0.0 the result is unspecified? NaN >= 0.0 is false, but even if it was unspecified, the implication would still be true. (In reply to Nikita Lisitsa fro

[Bug middle-end/91725] 275587[10 Regression] ICE in get_nonzero_bits starting with r275587

2019-09-10 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91725 --- Comment #2 from Marc Glisse --- (In reply to Jakub Jelinek from comment #1) > gcc10-pr91725.patch An alternative (I don't claim it is better) would be to make get_nonzero_bits conservatively return -1 on unknown input, like the comment befor

[Bug tree-optimization/90387] [9/10 Regression] __builtin_constant_p and -Warray-bounds warnings

2019-09-11 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90387 --- Comment #8 from Marc Glisse --- (In reply to Bernd Buschinski from comment #6) > From the comments I assumed that the fix is kind of trivial There is a simple change that gives the behavior you want on one example, but it is far from trivial

[Bug libstdc++/78113] std::variant and std::visit's current implementations do not get optimized out (compared to "recursive visitation")

2019-09-16 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78113 --- Comment #6 from Marc Glisse --- (looking at the first testcase) There are 2 things. One is the implementation strategy in libstdc++ vs boost vs others (I don't know what is best, it probably depends on the application). The other one is that

[Bug libstdc++/91788] New: std::variant index +1-1

2019-09-16 Thread glisse at gcc dot gnu.org
Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- (this is a detail, it probably has a negligible impact) constexpr size_t index() const noexcept { return size_t(typename _Base::__index_type

[Bug libstdc++/91788] std::variant index +1-1

2019-09-16 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91788 --- Comment #1 from Marc Glisse --- Internally, it may also be possible to avoid calling index() so often and work with the raw _M_index more often.

[Bug tree-optimization/91789] Value ranges determined from comparisons not used transitively

2019-09-16 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91789 --- Comment #2 from Marc Glisse --- We do manage if you swap the order of the first 2 comparisons, because this way we don't need to remember symbolic ranges: a<0 yields a range [0,inf] for a, b

[Bug libstdc++/91788] std::variant index +1-1

2019-09-23 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91788 --- Comment #3 from Marc Glisse --- (In reply to Jonathan Wakely from comment #2) > I think we can do that more generically. Does this look right? lgtm > (The downside would be that many more functions might need to be > friends to access _M_in

[Bug middle-end/91866] Sign extend of an int is not recognized

2019-09-23 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91866 --- Comment #1 from Marc Glisse --- See https://gcc.gnu.org/ml/gcc-patches/2019-08/msg00821.html

[Bug sanitizer/91878] No sanitizer report for past-end access of std∷set

2019-09-24 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91878 --- Comment #3 from Marc Glisse --- -D_GLIBCXX_DEBUG is the current way to add many checks to libstdc++, and it detects this.

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-25 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889 --- Comment #8 from Marc Glisse --- int i; void f(int* const&) { } void f(const int* const &) { } void g(int* p) { f(p); } void h() { f(&i); } I find it painful that g is ambiguous, and confusing that h remains ok. It needs confirmation that CWG

[Bug c++/86173] Default construction of a union (in std::optional)

2019-09-27 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86173 --- Comment #5 from Marc Glisse --- A similar example was reported on https://stackoverflow.com/q/57964217/1918193

[Bug c++/91958] type info does not respect 'noexcept' on C++17 function types

2019-10-01 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91958 --- Comment #1 from Marc Glisse --- PR 83534 ? (it could also be related to bug 67772, but it is a bit further)

[Bug tree-optimization/91940] __builtin_bswap16 loop optimization

2019-10-02 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91940 --- Comment #7 from Marc Glisse --- (In reply to Jakub Jelinek from comment #1) > The loop with the rotate is vectorized, while the one with __builtin_bswap16 > is not. It is a bit surprising that we do not canonicalize one to the other somewher

[Bug tree-optimization/91965] missing simplification for (C - a) << N

2019-10-02 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91965 --- Comment #2 from Marc Glisse --- (In reply to Alexander Monakov from comment #0) > Do we want to handle this early on via match.pd? Perhaps also applies to > simplifying (a +- C) << N. What exact transformation do you want? Canonicalize the c

[Bug target/91796] Sub-optimal YMM register allocation.

2019-10-11 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91796 --- Comment #7 from Marc Glisse --- (In reply to Maxim Egorushkin from comment #3) > It seems to me that register allocation has been a weak spot in gcc for > years. Most such testcases show issues with arguments/return in very small functions,

<    5   6   7   8   9   10   11   12   13   14   >