[Bug target/80813] x86: std::vector::operator[] could be somewhat faster using BT instead of SHL

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80813

--- Comment #1 from Andrew Pinski  ---
Note the code is worse in GCC 11+, there seems to be a missing optimization on
the gimple level ...

[Bug target/101543] extra zeroing of empty struct argument/return value

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101543

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=98884

--- Comment #1 from Andrew Pinski  ---
This is similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98884 but with
still not skipping the register part.

[Bug target/101543] New: extra zeroing of empty struct argument/return value

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101543

Bug ID: 101543
   Summary: extra zeroing of empty struct argument/return value
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: enhancement
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
Target: aarch64-linux-gnu

Take:
struct Tag {
friend Tag make_tag();
private:
Tag() {}
};

Tag make_tag() { 
return Tag{}; 
};

void needs_tag(Tag);

void foo1(void) {
Tag t = make_tag();
needs_tag(t);
}


struct Tag1 {};
struct Tag2 {};
struct Tag3 {};
struct Tag4 {};
struct Tag5 {};

void needs_tags(int x, Tag1 t1, Tag2 t2, Tag3 t3, Tag4 t4, Tag5 t5, int y);

void foo2(Tag1 t1, Tag2 t2, Tag3 t3, Tag4 t4, Tag5 t5)
{
needs_tags(12345, t1, t2, t3, t4, t5, t6, t7,t8, 200);
}

 CUT ---
In make_tag the return register does not need to be zerod.
In foo1, the argument x0 does not need to be zeroed before passing to
needs_tag.
In foo2, argument registers x1-x5 don't need to have been zeroed before passing
to needs_tags.

[Bug target/64405] [arm] Invalid codegenaration for ARMv3 and ARMv2

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64405

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |9.0
 Resolution|--- |WONTFIX
 Status|NEW |RESOLVED

--- Comment #5 from Andrew Pinski  ---
ARMv3/ARMv2 support was removed in GCC 9+ (r9-404). So closing as won't fix.

[Bug target/61287] "error: ‘nios2_fpu_insn_enabled’ was not declared in this scope" when building with ada

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61287

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   Target Milestone|--- |12.0
 Status|UNCONFIRMED |RESOLVED

--- Comment #2 from Andrew Pinski  ---
Fixed for GCC 12 by r12-291.

[Bug middle-end/61577] [4.9.0 Regression] can't compile on hp-ux v3 ia64

2021-07-20 Thread me at larbob dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577

--- Comment #269 from Larkin Nickle  ---
(In reply to The Written Word from comment #268)
> (In reply to Larkin Nickle from comment #262)
> > Created attachment 51182 [details]
> > GCC 11.1 patch to net dwarf2 debugging symbols
> > 
> > Rebuilding with this patch. Should hopefully net me actual dwarf2 debug
> > symbols.
> 
> What if you use the GCC --gdwarf-2 option instead of this patch? Does the
> patch just set the default DWARF version? Seems like if GCC supports DWARF
> >2, --gdwarf-2 should generate just v2 DWARF info.

Yes, I think that should work fine too.

[Bug target/31679] Incorrect result of multiplication long long by 0xFFFFFFFFLL constant.

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31679

--- Comment #7 from Andrew Pinski  ---
HWI is always 64bit these days so I doubt this can be reproduced.

[Bug target/39329] x86 -Os could use mulw for (uint16 * uint16)>>16

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39329

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug middle-end/61577] [4.9.0 Regression] can't compile on hp-ux v3 ia64

2021-07-20 Thread bugzilla-gcc at thewrittenword dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577

--- Comment #268 from The Written Word  
---
(In reply to Larkin Nickle from comment #262)
> Created attachment 51182 [details]
> GCC 11.1 patch to net dwarf2 debugging symbols
> 
> Rebuilding with this patch. Should hopefully net me actual dwarf2 debug
> symbols.

What if you use the GCC --gdwarf-2 option instead of this patch? Does the patch
just set the default DWARF version? Seems like if GCC supports DWARF >2,
--gdwarf-2 should generate just v2 DWARF info.

[Bug target/21812] libgcc could use some ia32/x86_64 specific optimizations

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21812

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Keywords||missed-optimization

--- Comment #5 from Andrew Pinski  ---
I wonder how important this is any more since popcount instruction is in
x86_64v2 which is almost every x86_64 chip since 2006 or so.

[Bug target/13588] little-endian code generated inappropriately

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=13588

Andrew Pinski  changed:

   What|Removed |Added

   Host|i686-cygwin |
   Last reconfirmed|2004-04-18 04:15:35 |2021-7-20
  Build|i686-cygwin |

--- Comment #2 from Andrew Pinski  ---
Still true on the trunk:
#define TARGET_DEFAULT  \
  (MASK_HARDLIT \
   | MASK_DIV   \
   | MASK_RELAX_IMM \
   | MASK_M340  \
   | MASK_LITTLE_END)

#define CPP_SPEC "%{m210:%{mlittle-endian:%ethe m210 does not have little
endian support}}"


m210
Target RejectNegative InverseMask(M340)

[Bug tree-optimization/88763] Better Output for Loop Unswitching

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88763

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||diagnostic
   Severity|normal  |enhancement

[Bug tree-optimization/84416] [9/10/11/12 Regression] internal compiler error: in int_cst_value, at tree.c:11089

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84416

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |9.5

[Bug tree-optimization/84416] [9/10/11/12 Regression] internal compiler error: in int_cst_value, at tree.c:11089

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84416

Andrew Pinski  changed:

   What|Removed |Added

  Known to work||4.2.0, 4.8.5
   Last reconfirmed|2018-02-16 00:00:00 |2021-7-20
Summary|internal compiler error: in |[9/10/11/12 Regression]
   |int_cst_value, at   |internal compiler error: in
   |tree.c:11089|int_cst_value, at
   ||tree.c:11089

--- Comment #3 from Andrew Pinski  ---
4.2.0 definitely can compile this as pcom was not there.

[Bug tree-optimization/88531] Index data types when targeting AVX-512 vectorization with gather/scatter

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88531

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
 Blocks||53947
   Severity|normal  |enhancement


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

[Bug tree-optimization/85017] Missed constant propagation to index of array reference

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85017

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
   Severity|normal  |enhancement

[Bug tree-optimization/64716] Missed vectorization in a hot code of SPEC2000 ammp

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64716

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Keywords||missed-optimization

[Bug tree-optimization/81558] Loop not vectorized

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81558

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
   Severity|normal  |enhancement

[Bug tree-optimization/54935] No way to do if converison

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54935

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Keywords||missed-optimization

[Bug tree-optimization/57204] Auto-vectorization in nested loops with non-varying indexed array access results in very poor performance (worse than no auto-vectorization)

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57204

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Keywords||missed-optimization

[Bug tree-optimization/58280] Missed Opportunity for Aligned Vectorized Load

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58280

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=63202
   Keywords||missed-optimization
 Blocks||53947

--- Comment #6 from Andrew Pinski  ---
Related to PR63202 too.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

[Bug tree-optimization/58902] small matrix multiplication non vectorized

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58902

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Keywords||missed-optimization
 Blocks||53947


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

[Bug tree-optimization/56717] Enhance Dot-product pattern recognition to avoid mult widening.

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56717

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
   Severity|normal  |enhancement

[Bug tree-optimization/42172] inefficient bit fields assignments

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42172

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   Target Milestone|--- |7.0
 Status|NEW |RESOLVED

--- Comment #12 from Andrew Pinski  ---
Fixed already fully in GCC 7, there are already testcases committed for this.
Most likely r7-4171 .

[Bug tree-optimization/42172] inefficient bit fields assignments

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42172

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
   Severity|normal  |enhancement

[Bug middle-end/61577] [4.9.0 Regression] can't compile on hp-ux v3 ia64

2021-07-20 Thread bugzilla-gcc at thewrittenword dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577

--- Comment #267 from The Written Word  
---
(In reply to Larkin Nickle from comment #266)
> I'll try that 7.9.1 as a last resort; I noticed that 7.3.1 was able to read
> dwarf4 symbols from a previous 4.9.2 build I did so I'm testing building
> 11.1 patched to produce debug symbols similarly.

7.9.1 was the last version that had support for HP-UX.

[Bug libstdc++/101542] New: __gnu_cxx::sequence_buffer const copy constructor is badly broken

2021-07-20 Thread brooks at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101542

Bug ID: 101542
   Summary: __gnu_cxx::sequence_buffer const copy constructor is
badly broken
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: brooks at gcc dot gnu.org
  Target Milestone: ---

This problem showed up when we were running the GCC 4.9.4 testsuite with the
latest Clang trunk as the compiler, and found that the ext/rope/4.cc test
started failing -- producing "wibblewibble" when it should produce "wibble".

However, the problem is broader than that, and affects much more current GCC
versions as well -- as can be seen at https://godbolt.org/z/74W78rdWP. 
Compiling the following program with Clang trunk produces "hellohello" as
output:

#include 
#include 

template T make_copy(const T ) { return x; }

int main() {
std::string s;
__gnu_cxx::sequence_buffer a(s);
{
__gnu_cxx::sequence_buffer b = a;
b.push_back('h');
b.push_back('e');
b.push_back('l');
b.push_back('l');
b.push_back('o');

// Making a copy causes sequence_buffer to break.
make_copy(b);
}
std::cout << s;
}


This started failing with a recent Clang change
(https://github.com/llvm/llvm-project/commit/7d2d5a3a6d7aaa40468c30250bf6b0938ef02c08),
described as "Apply P1825 as Defect Report from C++11 up to C++20".  See
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1825r0.html for the
defect report details.  I would guess that GCC will be applying a similar
change.

My colleagues Jorge Gorbe and Richard Smith did a lot of digging on this, and
Richard explains the problem as follows:


The problem with sequence_buffer is that the sequence_buffer(const
sequence_buffer&) copy constructor copies the pending characters in the buffer
to the new copy, and when both are destroyed, they get flushed to the
underlying sequence twice.

But sequence_buffer is more broken than that: it also has another constructor,
sequence_buffer(sequence_buffer&) that has different semantics: it flushes the
source first. So if you only ever use non-const sequence_buffer objects, never
modify a copied-from object, and never do anything that would call the
sequence_buffer(const sequence_buffer&) constructor, it will appear to work.
And that's what this test was relying on.

Part of the consequence of the Clang change is that in code like this:

sequence_buffer f(sequence_buffer x) {
  return x;
}

... the return statement unconditionally behaves like return
(sequence_buffer&&)x;. And that means that we now choose the
sequence_buffer(const sequence_buffer&) constructor, not the
sequence_buffer(sequence_buffer&) constructor, because a non-const lvalue
reference can't bind to an rvalue.  Ultimately, I think that happens at line
342 of stl_algobase.h ("return __result"), here:
https://gcc.gnu.org/git?p=gcc.git;a=blame;f=libstdc%2B%2B-v3/include/bits/stl_algobase.h;hb=9b61c47826156fe17fd5f4306470ade01e2fc4dc#l238.

So: this libstdc++ code is broken, and the test really should never have
passed.


In our case, we're simply xfailing the test since we don't have any code that
uses __gnu_cxx::sequence_buffer or __gnu_cxx::rope, but I'm passing this bug
report along in hopes that it's useful to the libstdc++ maintainers.  :)

[Bug tree-optimization/51074] No constant folding performed for VEC_PERM_EXPR, VEC_INTERLEAVE*EXPR, VEC_EXTRACT*EXPR

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51074

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
   Severity|normal  |enhancement
 Resolution|--- |FIXED
   Target Milestone|--- |4.7.0
 Status|NEW |RESOLVED

--- Comment #11 from Andrew Pinski  ---
Fixed almost 10 years ago but was not closed.

[Bug tree-optimization/48092] associative property of builtins is not exploited on GIMPLE

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48092

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
   Severity|normal  |enhancement

[Bug tree-optimization/49773] use of class data members prevent vectorization

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49773

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
 Blocks||53947
   Keywords||missed-optimization


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

[Bug tree-optimization/33243] Missed opportunities for vectorization due to unhandled real_type

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33243

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Keywords||missed-optimization
 Blocks||53947


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

[Bug middle-end/61577] [4.9.0 Regression] can't compile on hp-ux v3 ia64

2021-07-20 Thread me at larbob dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577

--- Comment #266 from Larkin Nickle  ---
I'll try that 7.9.1 as a last resort; I noticed that 7.3.1 was able to read
dwarf4 symbols from a previous 4.9.2 build I did so I'm testing building 11.1
patched to produce debug symbols similarly.

[Bug middle-end/61577] [4.9.0 Regression] can't compile on hp-ux v3 ia64

2021-07-20 Thread bugzilla-gcc at thewrittenword dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577

--- Comment #265 from The Written Word  
---
(In reply to Larkin Nickle from comment #264)
> Oh, and I should mention this is what I get with 7.3.1 or 7.5.1:
> 
> Reading symbols from
> /home/larbob/Projects/build-gcc/builds/gcc-11.1.0/.o/prev-gcc/cc1...BFD:
> /home/larbob/Projects/build-gcc/builds/gcc-11.1.0/.o/prev-gcc/cc1 symbol
> number 7214 references nonexistent SHT_SYMTAB_SHNDX section
> Can't read symbols from
> /home/larbob/Projects/build-gcc/builds/gcc-11.1.0/.o/prev-gcc/cc1: File in
> wrong format

There's a GDB 7.9.1 at http://hpux.connect.org.uk/hppd/hpux/Gnu/gdb-7.9.1/.
Does it work better?

[Bug middle-end/93742] Optimization request: pattern-match typical addition overflow checks

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93742

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

--- Comment #4 from Andrew Pinski  ---
One thing which could be done is take:
  _1 = a_10(D) > 0;
  _2 = a_10(D) < 0;
  _3 = 2147483647 - a_10(D);  // INT_MAX - a
  _4 = _3 < b_11(D);
  _9 = _1 & _4;
  _5 = -2147483648 - a_10(D); // INT_MIN - a
  _6 = _5 > b_11(D);
  _13 = _2 & _6;
  _14 = _9 | _13;

And recognize that as 
  _5 = .ADD_OVERFLOW (a_3(D), b_4(D));
  _1 = IMAGPART_EXPR <_5>;

But that won't catch the original testcase right away though as the incoming
gimple has a lot of branches.

The above was provided by:
bool add_overflow(int a, int b, int *res) {
int t= 0;
int t1;
int ty = a > 0;
int ty1 = a < 0;
int tt = ty & b > INT_MAX - a;
int tt1 = ty1 &  b < INT_MIN - a;
if (tt | tt1) {
t1= 1;
} else {
*res = a + b;
t1= 0;
}
return t1;
}

Note not even clang is able to detect the above really.

[Bug libstdc++/101510] std::filesystem::create_directory on an existing symlink to a directory

2021-07-20 Thread enometh at meer dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101510

--- Comment #17 from Madhu  ---
*  "redi at gcc dot gnu.org" 

Wrote on Tue, 20 Jul 2021 19:38:18 +

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101510
> Fixed on trunk now, I'll backport it too, but not in time for 11.2

Thanks!

[Bug tree-optimization/87319] When vector is wrapped, expression is not optimized.

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87319

Andrew Pinski  changed:

   What|Removed |Added

  Component|middle-end  |tree-optimization

--- Comment #6 from Andrew Pinski  ---
Really this reduces down to just (now):
void test1(const int* a, const int* b, const int* c, int* d)
{
*d = *a * *c + *b * *c;
}
- CUT ---
We don't reassociate to just:
*d = (*a +* b) * *c;

For signed types (including signed vector types).

[Bug middle-end/82705] Missing tail calls for large structs

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82705

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2017-10-25 00:00:00 |2021-7-20
 Target|x86_64-*-*, i?86-*-*|x86_64-*-*, i?86-*-*,
   ||aarch64-*-*

--- Comment #2 from Andrew Pinski  ---
   = moo (); [return slot optimization] [tail call]

This is not even done on aarch64 where the two registers are the same.

[Bug middle-end/78115] Missed optimization for "int modulo 2^31"

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78115

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

--- Comment #3 from Andrew Pinski  ---
We get now:
  if (num_2(D) < 0)
goto ; [41.00%]
  else
goto ; [59.00%]

   [local count: 440234144]:
  num_3 = num_2(D) - -2147483648;

   [local count: 1073741824]:
  # num_1 = PHI 

So something like (psedu code):
(simplify
 (cond (lt @0 integer_zerop) (minus @0 INTEGER_CST@1) @0)
 (if (TYPE_SIGN (type) == SIGNED && @1 == type_min(type))
  (bit_and @0 type_max(type

[Bug middle-end/96633] missed optimization?

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96633

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=46235

--- Comment #4 from Andrew Pinski  ---
On the trunk we get:
cmpb$32, %dil
ja  .L3
movabsq $4294977024, %rax
btq %rdi, %rax
setc%al
ret
.L3:
xorl%eax, %eax
ret


Which is close.

The reason why we produce a bt now is because of PR46235.

[Bug middle-end/50384] Returning std::array is not optimal

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50384

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=90864
   Severity|normal  |enhancement

[Bug middle-end/20671] Poor bit-field code generation

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20671

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug tree-optimization/85234] missed optimisation opportunity for (~x >> CST)!=0 is not optimized to (((unsigned)x) < ~((1<

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85234

Andrew Pinski  changed:

   What|Removed |Added

Summary|missed optimisation |missed optimisation
   |opportunity for (~x >> n) ? |opportunity for (~x >>
   |a : b with n, a, b  |CST)!=0 is not optimized to
   |constants   |  (((unsigned)x) <
   ||~((1< ---
int f(int x)
{
return (~x >> 3) !=0;
}
int f2(int x)
{
return (((unsigned)x) < ~((1<<3) - 1));
}

The above is what LLVM does really

[Bug fortran/78219] [F08] specifying the kind of a FORALL index in the header

2021-07-20 Thread kargl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78219

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #7 from kargl at gcc dot gnu.org ---
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index d148de3e3b5..d7668f6a928 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -2350,6 +2350,34 @@ match_forall_iterator (gfc_forall_iterator **result)
   gfc_forall_iterator *iter;
   locus where;
   match m;
+  gfc_typespec ts;
+  bool seen_ts;
+
+  /* In Fortran 2018, one can do "forall (integer :: i = 1:20)".
+ Try to match an optional "type-spec ::"  */
+  seen_ts = false;
+  gfc_clear_ts ();
+  m = gfc_match_type_spec ();
+  if (m == MATCH_YES)
+{
+  seen_ts = (gfc_match (" ::") == MATCH_YES);
+
+  if (seen_ts)
+   {
+ if (!gfc_notify_std (GFC_STD_F2018, "FORALL includes a "
+  "type specification at %C"))
+   return MATCH_ERROR;
+
+ if (ts.type != BT_INTEGER)
+   {
+ gfc_error ("Type-spec at %L shall be INTEGER",
+_current_locus);
+ return MATCH_ERROR;
+   }
+   }
+}
+  else if (m == MATCH_ERROR)
+return m;

   where = gfc_current_locus;
   iter = XCNEW (gfc_forall_iterator);
@@ -2358,6 +2386,9 @@ match_forall_iterator (gfc_forall_iterator **result)
   if (m != MATCH_YES)
 goto cleanup;

+  if (seen_ts)
+iter->var->ts = ts;
+
   if (gfc_match_char ('=') != MATCH_YES
   || iter->var->expr_type != EXPR_VARIABLE)
 {

[Bug middle-end/95208] missed switch optimization as bit test

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95208

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

--- Comment #2 from Andrew Pinski  ---
This looks fixed in GCC 11.

[Bug middle-end/42972] Very bad bit field code

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42972

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
 CC||pinskia at gcc dot gnu.org

[Bug middle-end/61577] [4.9.0 Regression] can't compile on hp-ux v3 ia64

2021-07-20 Thread me at larbob dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577

--- Comment #263 from Larkin Nickle  ---
I'm having trouble actually getting a GDB that can read the resulting symbols
properly. 

readelf --debug-dump=info cc1 | grep -A 2 'Compilation Unit @'
  Compilation Unit @ offset 0x0:
   Length:0xa390 (32-bit)
   Version:   2

As shown above, using readelf, I've confirmed I am now getting DWARF2 symbols,
but I'm unable to read them with my own built GDB 7.3.1 or GDB 7.5.1 from
http://ftp.nluug.nl/os/HPUX/itrc/gcc-4.7.2-11.31.sd.bz. HP GDB 6.7 is able to
handle them somewhat:

Object file is generated with GNU compiler: GNU C++17 11.1.0 -g -O2 -fno-PIE
-fno-exceptions -fno-rtti -fasynchronous-unwind-tables
HP WDB does not support debugging of programs compiled with GNU compiler.
Some features may work, but it is not guaranteed.
HP recommends using HP aCC compiler, Refer:  http://www.hp.com/go/aCC
Refer http://www.hp.com/go/wdb for the support statement

done.

Running cc1 w/ the arguments that lead to the illegal instruction error (as
verified with -v):

Program received signal SIGILL, Illegal instruction
  si_code: 9 - ILL_REGNAT - Register NaT Consumption.
0x54af7f0:1 in get_ref_base_and_extent (exp=,
poffset=, psize=, pmax_size=,
preverse=) at ../../gcc/tree-dfa.c:525
525   maxsize = wi::to_poly_offset (asize) - bit_offset;

However, trying to get a backtrace with `bt` results in HP GDB core dumping:

#0  0x54af7f0:1 in get_ref_base_and_extent (exp=,
poffset=, psize=, pmax_size=,
preverse=) at ../../gcc/tree-dfa.c:525
Assertion failed: stacki == 0, file ../../../Src/gnu/gdb/dwarf2read.c, line
1579
ABORT instruction (core dumped)

[Bug tree-optimization/31862] Loop IM and other optimizations harmful for -fopenmp

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31862

Andrew Pinski  changed:

   What|Removed |Added

  Component|middle-end  |tree-optimization

--- Comment #26 from Andrew Pinski  ---
I think the majority of these issues have been fixed since moving over to the
C/C++ 11 memory model and there is an option to disable that via
-fallow-store-data-races

Is that correct?

[Bug c++/101219] [12 Regression] ice in perform_or_defer_access_check since r12-1804-g65870e75616ee435

2021-07-20 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101219

--- Comment #7 from Martin Sebor  ---
Thanks for tracking down the change that triggers the ICE!  I removed the
suppression in a few cases where it served no apparent purpose (wasn't
necessary to suppress warnings exercised by the test suite).  This was not the
primary but a secondary goal of the patch.  Jason is probably in the best
position to answer your questions, as well as why the removed suppression was
there to begin with and whether it should be restored.

[Bug middle-end/90864] Suboptimal codegen of structs in C/C++on x86_64

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90864

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Last reconfirmed|2019-06-13 00:00:00 |2021-7-20

[Bug middle-end/61577] [4.9.0 Regression] can't compile on hp-ux v3 ia64

2021-07-20 Thread me at larbob dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577

--- Comment #264 from Larkin Nickle  ---
Oh, and I should mention this is what I get with 7.3.1 or 7.5.1:

Reading symbols from
/home/larbob/Projects/build-gcc/builds/gcc-11.1.0/.o/prev-gcc/cc1...BFD:
/home/larbob/Projects/build-gcc/builds/gcc-11.1.0/.o/prev-gcc/cc1 symbol number
7214 references nonexistent SHT_SYMTAB_SHNDX section
Can't read symbols from
/home/larbob/Projects/build-gcc/builds/gcc-11.1.0/.o/prev-gcc/cc1: File in
wrong format

[Bug rtl-optimization/44608] unspecified signed overflow applied to unsigned int

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44608

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED

--- Comment #9 from Andrew Pinski  ---
This has been fixed since GCC 7.2 in the end.
This is a dup of bug 75964.

*** This bug has been marked as a duplicate of bug 75964 ***

[Bug middle-end/77295] missed optimisation when copying/moving union members

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77295

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug c++/101219] [12 Regression] ice in perform_or_defer_access_check since r12-1804-g65870e75616ee435

2021-07-20 Thread slyfox at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101219

--- Comment #6 from Sergei Trofimovich  ---
gcc internals doc says that binfo should be attached to every class/struct
(RECORD). I'm not sure if this case qualifies. Maybe?

Why this crash happens mechanically? I skimmed through commit 65870e75616ee43
("cp: add support for per-location warning groups.") and found a few places
where warning suppression was removed.

Returning the one around ptrmem prevents the crash from happening:

--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -3326,7 +3326,9 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree
member_name)
member = DECL_CHAIN (member))
 if (DECL_NAME (member) == member_name)
   break;
-  return build_simple_component_ref (ptrmem, member);
+  tree r = build_simple_component_ref (ptrmem, member);
+  suppress_warning(r);
+  return r;
 }

 /* Given an expression PTR for a pointer, return an expression

[Bug libstdc++/101527] The implementation of std::common_iterator::operator== seems to be wrong

2021-07-20 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101527

--- Comment #1 from 康桓瑋  ---
(In reply to 康桓瑋 from comment #0)
> But according to the description of [class.friend#10]: "Friendship is
> neither inherited nor transitive." this will cause the following valid codes
> to be rejected:

This is the implementation divergence of CWG1699.

[Bug middle-end/85234] missed optimisation opportunity for (~x >> n) ? a : b with n, a, b constants

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85234

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug tree-optimization/81161] poor code concatenating bitfields

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81161

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Keywords||missed-optimization
  Component|middle-end  |tree-optimization
 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org

--- Comment #5 from Andrew Pinski  ---
Mine. But might not get until next year.

[Bug middle-end/66741] loops not fused nor vectorized

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66741

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug tree-optimization/101541] New: Missing ABSU detection at gimple

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101541

Bug ID: 101541
   Summary: Missing ABSU detection at gimple
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: enhancement
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

While looking at PR 44608 and finding it was already fixed, I noticed instead
we should produce ABSU at the gimple level but don't currently.

Take:
unsigned abssat2 (int x)
{
unsigned int y = x;

if (x < 0)
y = -y;

  return y;
}

[Bug middle-end/70871] questionable optimisation in fold-const.c

2021-07-20 Thread jan.smets at nokia dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70871

--- Comment #6 from Jan Smets  ---
Sounds good. I appreciate the follow-up, thanks you for that.

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

Andrew Pinski  changed:

   What|Removed |Added

 CC||avr at gjlay dot de

--- Comment #12 from Andrew Pinski  ---
*** Bug 44608 has been marked as a duplicate of this bug. ***

[Bug middle-end/70871] questionable optimisation in fold-const.c

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70871

Andrew Pinski  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
 CC||pinskia at gcc dot gnu.org
   Keywords||missed-optimization,
   ||wrong-code
 Status|NEW |ASSIGNED

--- Comment #5 from Andrew Pinski  ---
Mine but I suspect it will be for GCC 13; I doubt I will get to the bitfield
related stuff until next year.  This year is mostly PHIOPT related
optimizations.

[Bug target/101104] test case gcc.c-torture/execute/ieee/cdivchkld.c fails

2021-07-20 Thread segher at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101104

Segher Boessenkool  changed:

   What|Removed |Added

 CC||segher at gcc dot gnu.org
  Component|testsuite   |target

--- Comment #2 from Segher Boessenkool  ---
(In reply to Patrick McGehearty from comment #1)
> I identified the root cause as not fully understanding the IBM native
> format. The gcc internal representation uses KF mode for IBM 128-bit
> floating point.

KFmode is IEEE QP float.  IFmode is double-double, "IBM extended double",
a pair of DP float numbers (with some rules, not every pair is valid).

TFmode is one of those.

[Bug ipa/94818] GCC emits dead bodies of functions whose all calls have been eliminated by optimisations

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94818

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug ipa/89139] GCC emits code for static functions that aren't used by the optimized code

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89139

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug middle-end/98865] Missed transform of (a >> 63) * b

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98865

Andrew Pinski  changed:

   What|Removed |Added

 CC||pinskia at gcc dot gnu.org

--- Comment #4 from Andrew Pinski  ---
Actually I think we should do:
(simplify
 (mult:c truth_valuep@0 @1)
 (and (neg @0) @1))

Instead. What do you think?

This will catch things like:
unsigned long foo (long a, unsigned long b)
{
  unsigned long t =  a & 1;
  return t * b;
}

 CUT ---
We can put a ! after neg if we want it to be optimized out even.

[Bug tree-optimization/101534] ICE in create_tailcall_accumulator, at tree-tailcall.c:1083

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101534

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||patch
URL||https://gcc.gnu.org/piperma
   ||il/gcc-patches/2021-July/57
   ||5692.html

--- Comment #5 from Andrew Pinski  ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575692.html

[Bug tree-optimization/101540] New: CONSTRUCTOR for vector(1) should just be VCE

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101540

Bug ID: 101540
   Summary: CONSTRUCTOR for vector(1) should just be VCE
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: enhancement
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

I noticed with the following source:
typedef unsigned char __attribute__((__vector_size__ (1))) W;
typedef unsigned char __attribute__((__vector_size__ (8))) V;
typedef unsigned short __attribute__((__vector_size__ (16))) U;

unsigned short us;

W
foo (unsigned char uc)
{
  V v = __builtin_convertvector ((U){ } >= us, V);
  return __builtin_shufflevector ((W){ }, v, 4) & uc;
}

int
main (void)
{
  W x = foo (5);
  if (x[0] != 5)
__builtin_abort();
  return 0;
}
- CUT 
We produce
_6 = {uc_10(D)};
But this should be the same as
_6 = VIEW_CONVERT_EXPR

--- CUT ---
This is what we get in the IR:
  _6 = {uc_10(D)};
  _14 = BIT_FIELD_REF <_4, 8, 0>;
  _15 = VIEW_CONVERT_EXPR(_6);
  _16 = _14 & _15;
  _17 = VIEW_CONVERT_EXPR(_16);

We do change the BIT_FIELD_REF that was assigned to _15 to a VCE though.

[Bug target/101529] wrong code with __builtin_convertvector() and __builtin_shufflevector() at -Og

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101529

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2021-07-20
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

--- Comment #1 from Andrew Pinski  ---
Confirmed.

-Og:
  _13 = BIT_FIELD_REF <_12, 64, 0>;
  _4 = VEC_PERM_EXPR <_13, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 3, 9, 10, 11, 12, 13,
14, 15 }>;
  _14 = BIT_FIELD_REF <_4, 8, 0>;


vs -O2:
  _14 = BIT_FIELD_REF <_12, 8, 24>;


Huh:

;; _4 = VEC_PERM_EXPR <_13, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 3, 9, 10, 11, 12, 13,
14, 15 }>;


(insn 16 15 17 (set (reg:V8QI 95 [ _4 ])
(vec_select:V8QI (reg:V16QI 98 [ _12 ])
(parallel [
(const_int 0 [0])
(const_int 1 [0x1])
(const_int 2 [0x2])
(const_int 3 [0x3])
(const_int 4 [0x4])
(const_int 5 [0x5])
(const_int 6 [0x6])
(const_int 7 [0x7])
]))) "t5.c":11:10 -1
 (nil))

;;; Select the lower part aka _13

(insn 17 16 18 (set (reg:V8QI 112)
(const_vector:V8QI [
(const_int 0 [0]) repeated x8
])) "t5.c":11:10 -1
 (nil))

(insn 18 17 19 (set (reg:V8QI 95 [ _4 ])
(reg:V8QI 112)) "t5.c":11:10 -1
 (nil))
;;; BUT reuse 95/_4 for the zero constant!!!

(insn 19 18 0 (set (reg:V8QI 95 [ _4 ])
(vec_merge:V8QI (vec_duplicate:V8QI (vec_select:QI (reg:V8QI 95 [ _4 ])
(parallel [
(const_int 3 [0x3])
])))
(reg:V8QI 95 [ _4 ])
(const_int 1 [0x1]))) "t5.c":11:10 -1
 (nil))

[Bug testsuite/101206] [12 Regression] gcc.target/aarch64/vect-vmaxv.c and gcc.target/aarch64/vect-vaddv.c fail

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101206

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=101506
 Resolution|--- |FIXED

--- Comment #2 from Andrew Pinski  ---
Fixed by  r12-2414.

[Bug rtl-optimization/101523] Huge number of combine attempts

2021-07-20 Thread segher at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101523

Segher Boessenkool  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |segher at gcc dot 
gnu.org

--- Comment #3 from Segher Boessenkool  ---
The "newi2pat = NULL_RTX;" you do there cannot be correct.  But the general
idea is fine, sure.  I'll work on it.

(nN

[Bug tree-optimization/101024] Missed min expression at phiopt1

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101024

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=87913

--- Comment #5 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #3)
> gcc.dg/tree-ssa/phi-opt-20.c is another case which is missing right now, it
> deals with EQ_EXPR/NE_EXPR.
Which was added with https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87913

[Bug fortran/101536] ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324

2021-07-20 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101536

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-07-20

--- Comment #2 from anlauf at gcc dot gnu.org ---
Confirmed.

I am testing the following:

diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 27bf3a7eafe..6d2d9fe4007 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -735,6 +735,10 @@ array_check (gfc_expr *e, int n)
&& CLASS_DATA (e)->attr.dimension
&& CLASS_DATA (e)->as->rank)
 {
+  if (e->ref && e->ref->type == REF_ARRAY
+ && e->ref->u.ar.type == AR_ELEMENT)
+   goto error;
+
   gfc_add_class_array_ref (e);
   return true;
 }
@@ -742,6 +746,7 @@ array_check (gfc_expr *e, int n)
   if (e->rank != 0 && e->ts.type != BT_PROCEDURE)
 return true;

+error:
   gfc_error ("%qs argument of %qs intrinsic at %L must be an array",
 gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
 >where);

[Bug c++/101539] [C++20] Implement builtins for layout-compatibility and pointer-interconvertibility traits

2021-07-20 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101539

Marek Polacek  changed:

   What|Removed |Added

   Last reconfirmed||2021-07-20
 Status|UNCONFIRMED |NEW
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug c++/101539] New: [C++20] Implement builtins for layout-compatibility and pointer-interconvertibility traits

2021-07-20 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101539

Bug ID: 101539
   Summary: [C++20] Implement builtins for layout-compatibility
and pointer-interconvertibility traits
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jason at gcc dot gnu.org
Blocks: 88322, 88323
  Target Milestone: ---

https://wg21.link/p0466


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88322
[Bug 88322] Implement C++20 library features.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88323
[Bug 88323] implement C++20 language features.

[Bug middle-end/101397] [11 Regression] spurious warning writing to the result of stpcpy minus 1

2021-07-20 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101397

Martin Sebor  changed:

   What|Removed |Added

  Known to fail||11.1.0
Summary|[11/12 Regression] spurious |[11 Regression] spurious
   |warning writing to the  |warning writing to the
   |result of stpcpy minus 1|result of stpcpy minus 1

--- Comment #5 from Martin Sebor  ---
Fixed in GCC 12.0.  Will backport to 11 after a bit.

[Bug middle-end/101397] [11/12 Regression] spurious warning writing to the result of stpcpy minus 1

2021-07-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101397

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Martin Sebor :

https://gcc.gnu.org/g:8bf5b49ebd2176b8c535147377381dd07fbdd643

commit r12-2422-g8bf5b49ebd2176b8c535147377381dd07fbdd643
Author: Martin Sebor 
Date:   Tue Jul 20 13:48:20 2021 -0600

Correct stpcpy offset computation for -Warray-bounds et al. [PR101397].

Resolves:
PR middle-end/101397 - spurious warning writing to the result of stpcpy
minus 1

gcc/ChangeLog:

PR middle-end/101397
* builtins.c (gimple_call_return_array): Add argument.  Correct
offsets for memchr, mempcpy, stpcpy, and stpncpy.
(compute_objsize_r): Adjust offset computation for argument
returning
built-ins.

gcc/testsuite/ChangeLog:

PR middle-end/101397
* gcc.dg/Warray-bounds-80.c: New test.
* gcc.dg/Warray-bounds-81.c: New test.
* gcc.dg/Warray-bounds-82.c: New test.
* gcc.dg/Warray-bounds-83.c: New test.
* gcc.dg/Warray-bounds-84.c: New test.
* gcc.dg/Wstringop-overflow-46.c: Adjust expected output.

[Bug fortran/101514] ICE: out of memory allocating 18446744073709551600 bytes

2021-07-20 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101514

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |anlauf at gcc dot 
gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
Improved patch with enhanced testcase:

https://gcc.gnu.org/pipermail/fortran/2021-July/056253.html

[Bug libstdc++/94295] use __builtin_operator_new and __builtin_operator_delete when available

2021-07-20 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94295

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||patch
 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |redi at gcc dot gnu.org

--- Comment #11 from Jonathan Wakely  ---
Patches posted:
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575675.html

[Bug c/63326] whether a #pragma is a statement depends on the type of pragma

2021-07-20 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63326

Martin Sebor  changed:

   What|Removed |Added

 CC||msebor at gcc dot gnu.org

--- Comment #32 from Martin Sebor  ---
*** Bug 101538 has been marked as a duplicate of this bug. ***

[Bug c/101538] [10/11/12 Regression] #pragma considered a statement

2021-07-20 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101538

Martin Sebor  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|UNCONFIRMED |RESOLVED
   Keywords||wrong-code

--- Comment #1 from Martin Sebor  ---
This a duplicate of pr63326.

*** This bug has been marked as a duplicate of bug 63326 ***

[Bug c/101538] New: [10/11/12 Regression] #pragma considered a statement

2021-07-20 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101538

Bug ID: 101538
   Summary: [10/11/12 Regression] #pragma considered a statement
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

In the following test case both #pragma directives are expected to be evaluated
at compile-time with no effect on the emitted object code.  Since the
conditional evaluates to zero the call to abort is expected to be eliminated. 
Yet the emitted code shows that GCC treats the first #pragma as the empty
statement, thus ending the if statement.  The end result is that the abort call
is made unconditionally.   In the second instance, the unknown #pragma is
ignored and the code behaves as expected.  That there's a difference between
the two is only hinted on by the -Wunknown-pragmas warning when it's enabled.

Clang and ICC behave as expected, as does G++ and GCC 4.1 (which doesn't
recognize #pragma message).

This was noticed when using #pragma GCC diagnostic and noted here:
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575613.html

$ cat a.c && gcc -O2 -S -Wall -fdump-tree-optimized=/dev/stdout a.c
void f (void)
{
  if (""['\0'])
#pragma message "Gotcha!"
__builtin_abort ();
}

void g (void)
{ 
  if (""['\0'])
#pragma "Okay"
__builtin_abort ();
}

a.c: In function ‘f’:
a.c:4:9: note: ‘#pragma message: Gotcha!’
4 | #pragma message "Gotcha!"
  | ^~~
a.c: In function ‘g’:
a.c:11: warning: ignoring ‘#pragma "Okay" ’ [-Wunknown-pragmas]
   11 | #pragma "Okay"
  | 

;; Function f (f, funcdef_no=0, decl_uid=1943, cgraph_uid=1, symbol_order=0)
(unlikely executed)

void f ()
{
   [count: 0]:
  __builtin_abort ();

}



;; Function g (g, funcdef_no=1, decl_uid=1946, cgraph_uid=2, symbol_order=1)

void g ()
{
   [local count: 1073741824]:
  return;

}

[Bug libstdc++/101510] std::filesystem::create_directory on an existing symlink to a directory

2021-07-20 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101510

--- Comment #16 from Jonathan Wakely  ---
Fixed on trunk now, I'll backport it too, but not in time for 11.2

[Bug libstdc++/101510] std::filesystem::create_directory on an existing symlink to a directory

2021-07-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101510

--- Comment #15 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:124eaa50e0a34f5f89572c1aa812c50979da58fc

commit r12-2421-g124eaa50e0a34f5f89572c1aa812c50979da58fc
Author: Jonathan Wakely 
Date:   Tue Jul 20 18:15:48 2021 +0100

libstdc++: Fix create_directories to resolve symlinks [PR101510]

When filesystem__create_directories checks to see if the path already
exists and resovles to a directory, it uses filesystem::symlink_status,
which means it reports an error if the path is a symlink. It should use
filesystem::status, so that the target directory is detected, and no
error is reported.

Signed-off-by: Jonathan Wakely 

libstdc++-v3/ChangeLog:

PR libstdc++/101510
* src/c++17/fs_ops.cc (fs::create_directories): Use status
instead of symlink_status.
* src/filesystem/ops.cc (fs::create_directories): Likewise.
* testsuite/27_io/filesystem/operations/create_directories.cc:
* testsuite/27_io/filesystem/operations/create_directory.cc: Do
not test with symlinks on Windows.
*
testsuite/experimental/filesystem/operations/create_directories.cc:
* testsuite/experimental/filesystem/operations/create_directory.cc:
Do not test with symlinks on Windows.

[Bug libstdc++/94295] use __builtin_operator_new and __builtin_operator_delete when available

2021-07-20 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94295

--- Comment #10 from Jason Merrill  ---
(In reply to Richard Smith from comment #4)
> Yep, looks like GCC miscompiles direct calls to operator new / operator
> delete since that patch landed: https://godbolt.org/z/dK99Rz

Note that this is true only of GCC 10.x.

[Bug middle-end/24639] [meta-bug] bug to track all Wuninitialized issues

2021-07-20 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
Bug 24639 depends on bug 101300, which changed state.

Bug 101300 Summary: -fsanitize=undefined suppresses -Wuninitialized
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101300

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

[Bug middle-end/101300] -fsanitize=undefined suppresses -Wuninitialized

2021-07-20 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101300

Martin Sebor  changed:

   What|Removed |Added

 Resolution|--- |FIXED
  Known to fail|12.0|
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Martin Sebor  ---
Done for GCC 12 in r12-2420.

[Bug middle-end/101300] -fsanitize=undefined suppresses -Wuninitialized

2021-07-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101300

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Martin Sebor :

https://gcc.gnu.org/g:e07d30fdcaec4906e0dcb948fc4748bf74c15c05

commit r12-2420-ge07d30fdcaec4906e0dcb948fc4748bf74c15c05
Author: Martin Sebor 
Date:   Tue Jul 20 13:08:39 2021 -0600

Handle all UBSAN built-ins in -Wuninitialized [PR101300].

Resolves:
PR middle-end/101300 - -fsanitize=undefined suppresses -Wuninitialized for
a VLA read at -O0

gcc/ChangeLog:
PR middle-end/101300
* tree-ssa-uninit.c (check_defs): Handle UBSAN built-ins.

gcc/testsuite/ChangeLog:
PR middle-end/101300
* gcc.dg/uninit-pr101300.c: New test.

[Bug libstdc++/94295] use __builtin_operator_new and __builtin_operator_delete when available

2021-07-20 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94295

--- Comment #9 from Jonathan Wakely  ---
Thanks

[Bug libstdc++/94295] use __builtin_operator_new and __builtin_operator_delete when available

2021-07-20 Thread richard-gccbugzilla at metafoo dot co.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94295

--- Comment #8 from Richard Smith  ---
(In reply to Jonathan Wakely from comment #7)
> Richard S., is there any reason to use the built-ins for the constant
> evaluation case?

No, Clang's constant evaluator treats the built-ins and calls to replaceable
global [de]allocation functions identically. (The built-ins might be
*marginally* more efficient, but it's not worth an #ifdef.)

[Bug tree-optimization/101534] ICE in create_tailcall_accumulator, at tree-tailcall.c:1083

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101534

--- Comment #4 from Andrew Pinski  ---
Created attachment 51183
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51183=edit
Patch which is under testing

[Bug fortran/101514] ICE: out of memory allocating 18446744073709551600 bytes

2021-07-20 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101514

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 CC||anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
Something like the following fixes the problem:

diff --git a/gcc/fortran/target-memory.c b/gcc/fortran/target-memory.c
index cfa8402dd3f..4be36bef856 100644
--- a/gcc/fortran/target-memory.c
+++ b/gcc/fortran/target-memory.c
@@ -534,6 +534,9 @@ gfc_interpret_derived (unsigned char *buffer, size_t
buffer_size, gfc_expr *resu
{
  int n;

+ if (cmp->as->type == AS_ASSUMED_RANK || cmp->as->rank < 0)
+   return 0;
+
  e->expr_type = EXPR_ARRAY;
  e->rank = cmp->as->rank;

[Bug middle-end/61577] [4.9.0 Regression] can't compile on hp-ux v3 ia64

2021-07-20 Thread me at larbob dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577

--- Comment #262 from Larkin Nickle  ---
Created attachment 51182
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51182=edit
GCC 11.1 patch to net dwarf2 debugging symbols

Rebuilding with this patch. Should hopefully net me actual dwarf2 debug
symbols.

[Bug tree-optimization/101534] ICE in create_tailcall_accumulator, at tree-tailcall.c:1083

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101534

--- Comment #3 from Andrew Pinski  ---
The fix which I am testing:
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -1080,6 +1080,9 @@ create_tailcall_accumulator (const char *label,
basic_block bb, tree init)

   phi = create_phi_node (tmp, bb);
   /* RET_TYPE can be a float when -ffast-maths is enabled.  */
+  /* For vectors create a dup. */
+  if (VECTOR_TYPE_P (ret_type))
+init = build_vector_from_val (ret_type, fold_convert (TREE_TYPE
(ret_type), init));
   add_phi_arg (phi, fold_convert (ret_type, init), single_pred_edge (bb),
   UNKNOWN_LOCATION);
   return PHI_RESULT (phi);

[Bug tree-optimization/101534] ICE in create_tailcall_accumulator, at tree-tailcall.c:1083

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101534

Andrew Pinski  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org

--- Comment #2 from Andrew Pinski  ---
Mine.

[Bug debug/101473] debug_line info depends on toolchain path

2021-07-20 Thread tonyb at cybernetics dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101473

--- Comment #18 from tonyb at cybernetics dot com ---
Created attachment 51181
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51181=edit
LTO reproducible build test: -ffile-prefix-map in LDFLAGS

tar xjf lto-test.tar.bz2
cd lto-test
./run-lto-test
FAIL - LTO build is not reproducible
edit run-lto-test and change ENABLE_FIX to 1
./run-lto-test
PASS - LTO build is reproducible

[Bug middle-end/61577] [4.9.0 Regression] can't compile on hp-ux v3 ia64

2021-07-20 Thread me at larbob dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577

--- Comment #261 from Larkin Nickle  ---
https://gcc.gnu.org/bugzilla//show_bug.cgi?id=59447

Argh, it seems that `--with-dwarf2` basically just means use dwarf2 *or later*,
at least in GCCs this new. Will patch gcc/common.opt and rebuild.

[Bug debug/101473] debug_line info depends on toolchain path

2021-07-20 Thread tonyb at cybernetics dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101473

--- Comment #17 from tonyb at cybernetics dot com ---
(In reply to Richard Biener from comment #16)
> I'm interested if remaining differences are due to the same underlying issue
> or not

I tested your updated patch with gcc 10.2 (I had to make a small change due to
the definition of struct dwarf_file_data being in dwarf2out.c rather than
dwarf2out.h in gcc 10.2).  I got the same results as before, with the same list
of files being non-reproducible.  I decided to debug the problem with pciutils.
 For pciutils, the problem was caused by the following:

Yocto CFLAGS contains -ffile-prefix-map but LDFLAGS doesn't.
The pciutils Makefile compiles *.c files to *.o files with CFLAGS and links
them with LDFLAGS but not CFLAGS.
With LTO disabled, this results in a reproducible binary, but with LTO enabled,
this results in a non-reproducible binary.

So I can workaround by adding -ffile-prefix-map to LDFLAGS.

So is this considered a bug?  If the prefix map translation can be handled
completely before generating the *.o file, then it could be fixed in gcc, but I
am not sure how it all works.  One solution that is apparently off the table is
embedding the prefix map in the *.o file, since that would make the *.o file
non-reproducible (see e.g. bug 68848; apparently the prefix map used to be
present in the *.o file but was removed in some recent version of gcc).

If this issue is not considered a bug, then I will pass on to the Yocto people
that they should use -ffile-prefix-map in LDFLAGS in addition to CFLAGS, and
you can close this PR.

I haven't looked into the other packages that were not reproducible, but I
suspect the same issue.

I will attach a test script that shows the issue if you want to debug it
further.

[Bug tree-optimization/101534] ICE in create_tailcall_accumulator, at tree-tailcall.c:1083

2021-07-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101534

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
  Component|c   |tree-optimization
   Last reconfirmed||2021-07-20
 Status|UNCONFIRMED |NEW

--- Comment #1 from Andrew Pinski  ---
Confirmed.
(gdb) p debug_tree(ret_type)
 
unit-size 
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xf59b05e8 precision:32 min  max

pointer_to_this >
sizes-gimplified V2SI
size  constant 64>
unit-size  constant 8>
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xf59db670 nunits:2 context >
$1 = void
(gdb) p debug_tree(init)
  constant 1>


create_tailcall_accumulator needs to create a splat/dup if the init type is
scalar and the ret_type is a vector.

[Bug c++/93652] -Wconversion gives false warning with bitwise operations on reference types returned from function

2021-07-20 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93652

--- Comment #3 from Jonathan Wakely  ---
Fixed by r10-7344:
c++: Handle COMPOUND_EXPRs in get_narrower and
warnings_for_convert_and_check [PR91993]

[Bug c++/38522] -Wconversion does not handle complex bitwise expressions

2021-07-20 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38522

Jonathan Wakely  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #12 from Jonathan Wakely  ---
Comment 3 was fixed by r230365 "Merge C++ delayed folding branch."

Comment 9 was fixed by r10-7344:
"c++: Handle COMPOUND_EXPRs in get_narrower and warnings_for_convert_and_check
[PR91993]"

  1   2   3   >