[Bug c++/101338] New: Redeclaration of template members in subclass fails

2021-07-06 Thread josipp at live dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101338

Bug ID: 101338
   Summary: Redeclaration of template members in subclass fails
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: josipp at live dot de
  Target Milestone: ---
  Host: macOS 11.4
Target: x86-64
 Build: Homebrew GCC 11.1.0_1

Using g++ -std=c++20 -Wall -Wextra in every example, this one compiles.
---
struct B
{
template  struct Inner;
template  struct Inner<0, i> {};

template  struct Inner;
template  struct Inner<1, i> {};
}
---
As does this.
---
struct A
{
template  struct Inner;
template  struct Inner<0, i> {}; // Instantiates A::Inner
}

struct B: A
{
template  struct Inner; // OK, shadows declaration in A
template  struct Inner<0, i> {}; // Instantiates B::Inner
}
---
But this one does not, complaining about redeclaration of 'template, int  > struct B::Inner':
---
struct A
{
template  struct Inner;
template  struct Inner<0, i> {};
}

struct B: A
{
template  struct Inner; // OK, shadows declaration in A
template  struct Inner<0, i> {};

template  struct Inner; // Fail, redeclaration.
}
---
The last example is inconsistent with the first, where the two declarations
happily live side by side together.

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

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

--- Comment #3 from Andrew Pinski  ---
gcc.dg/tree-ssa/phi-opt-20.c is another case which is missing right now, it
deals with EQ_EXPR/NE_EXPR.

[Bug tree-optimization/101256] [12 Regression] Wrong code with -O3 since r12-1841-g9fe9c45ae33a2df7

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

--- Comment #8 from CVS Commits  ---
The master branch has been updated by Andrew Pinski :

https://gcc.gnu.org/g:51abfb6a893c87dbf84a33009b6cd6dbd25d66f1

commit r12-2048-g51abfb6a893c87dbf84a33009b6cd6dbd25d66f1
Author: Andrew Pinski 
Date:   Tue Jun 29 14:30:34 2021 -0700

Fix 101256: Wrong code due to range incorrect from PHI-OPT

So the problem here is that replace_phi_edge_with_variable
will copy range information to a already (not newly) defined
ssa name.  This causes wrong code later on.
This fixes the problem by require the new ssa name to
be defined in the same bb as the conditional that is
about to be deleted.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Changes from v1:
* this is a simplification of what was trying to be done before.

gcc/ChangeLog:

PR tree-optimization/101256
* dbgcnt.def (phiopt_edge_range): New counter.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable):
Check to make sure the new name is defined in the same
bb as the conditional before duplicating range info.
Also add debug counter.

gcc/testsuite/ChangeLog:

PR tree-optimization/101256
* g++.dg/torture/pr101256.C: New test.

[Bug target/100782] [11 Regression] sh4 ICEs on -O2 -fPIE -fstack-protector: internal compiler error: in curr_insn_transform, at lra-constraints.c:4132

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

--- Comment #3 from Sergei Trofimovich  ---
(In reply to Richard Biener from comment #2)
> The description says:
> 
> gcc version 12.0.0 20210526 (experimental) (GCC)
> 
> so is this about GCC 12 or GCC 11?  What version worked fine (why's this
> marked as regression?)

My apologies. It should be a gcc-11 regression. More gcc versions outputs:

$ /tmp:sh4-unknown-linux-gnu-gcc-10.3.0 -O2 -mlra -fexceptions -fPIE
-fstack-protector -c a.c


$ sh4-unknown-linux-gnu-gcc-11.1.0 -O2 -mlra -fexceptions -fPIE
-fstack-protector -c a.c
a.c: In function 'ffi_raw_call_cif':
a.c:9:1: error: unable to generate reloads for:
9 | }
  | ^
(call_insn 18 16 20 2 (parallel [
(call (mem:SI (symbol_ref:SI ("ffi_raw_to_ptrarray") [flags 0x41]
) [0 ffi_raw_to_ptrarray S4
A32])
(const_int 0 [0]))
(use (reg:SI 154 fpscr0))
(use (reg:SI 12 r12))
(clobber (reg:SI 146 pr))
(clobber (reg:SI 183))
]) "a.c":7:3 228 {call_pcrel}
 (expr_list:REG_CALL_DECL (symbol_ref:SI ("ffi_raw_to_ptrarray") [flags
0x41] )
(nil))
(nil))
during RTL pass: reload
a.c:9:1: internal compiler error: in curr_insn_transform, at
lra-constraints.c:4138
0x7f3c4ea9e7ac __libc_start_main
../csu/libc-start.c:332
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug tree-optimization/101256] [12 Regression] Wrong code with -O3 since r12-1841-g9fe9c45ae33a2df7

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #9 from Andrew Pinski  ---
Fixed.

[Bug middle-end/101326] std::optional returns forced through stack

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

--- Comment #4 from Andrew Pinski  ---
(In reply to Richard Biener from comment #3)
> and yes, if it would have had TImode we could expand it to a register pair
> but it has BLKmode because it's TYPE_NEEDS_CONSTRUCTING(?), the type
> isn't TREE_ADDRESSABLE for me.

Yes TYPE_NEEDS_CONSTRUCTING, I had thought they were the same bit but I am
wrong.

[Bug tree-optimization/25290] PHI-OPT could be rewritten so that is uses match

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

--- Comment #25 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #22)
So an update on this

> * abs_replacement: needs PROP_gimple_lswitch so we don't change if
> statements early enough
> ** I think majority of the abs handling is already in match.pd.

abs_replacement is done and removed :).

> * minmax_replacement: has some handling of comparisions which might not be
> in the match.pd patterns already.  needs PROP_gimple_lswitch also.
> ** The handling of:
>if (a <= u)
>  b = MAX (a, d);
>x = PHI 
>needs to moved too.
> 

The minmax is recorded as PR 101024.  There is some more improvements to
gimple_simplify_phiopt needed for early_p as the way min/max patterns are
generated in match.pd (extra casts).

[Bug tree-optimization/42117] VRP should do if-conversion

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
I am not going to fix this.
But right now we get:
  _8 = x_5(D) | y_6(D);
  _4 = (unsigned int) _8;
  if (_4 <= 1)
goto ; [57.43%]
  else
goto ; [42.57%]

   [local count: 616649929]:
  if (x_5(D) != 0)
goto ; [50.00%]
  else
goto ; [50.00%]

   [local count: 126413234]:
  _9 = y_6(D) != 0;
  _1 = (int) _9;

   [local count: 1073741824]:
  # _3 = PHI 

Part of the problem is realizing y_6 is [0,1] range when looking at _9/_1.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42195
[Bug 42195] missed xnor optimization.

[Bug middle-end/59424] Optimization issue on min/max

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #5 from Andrew Pinski  ---
I have a fix which I was working on for PR 56223.
Basically factor_out_conditional_conversion can be extended to support more
than conversions :).

[Bug tree-optimization/49959] ABS pattern is not recognized

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

Andrew Pinski  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
 Status|NEW |ASSIGNED
   Severity|normal  |enhancement
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=59424
   Keywords||missed-optimization

--- Comment #3 from Andrew Pinski  ---
I have a fix.
This is related to PR 59424 (part of that fixes this one).

[Bug middle-end/54571] Missed optimization converting between bit sets

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

--- Comment #2 from Andrew Pinski  ---
(In reply to Richard Biener from comment #1)
> Confirmed.  The natural place to optimize this is the tree level phiopt pass.
> 
>   :
>   _3 = x_2(D) & 2;
>   if (_3 != 0)
> goto ;
>   else
> goto ;
> 
>   :
>   y_5 = y_4(D) | 1;
> 
>   :
>   # y_1 = PHI 
> 
> where we should handle
> 
> int f1(int x, int y, int d) { int tem; if ((tem = x & d)) y |= tem; return
> y; }
> 
> as well.  Yes, that's just y |= x & d, but it falls out naturally if the
> transform is implemented in a generic enough way.


This one should be easy to add to match.pd:

(simplify
 (cond @1 (ior @2 INTEGER_CST@3) @2)
 (ior @2 (bit_and (negate (convert @1)) @3)))


(bit_and (negate (convert thurth_value@1)) integer_onep)
should be just converted to:
@1
Which is not done right now, I fill that as a bug.

[Bug tree-optimization/70547] Optimize multiplication of booleans to bit_and

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

Andrew Pinski  changed:

   What|Removed |Added

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

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

[Bug tree-optimization/101339] New: (bit_and (negate (convert thurth_value@1)) integer_onep) is not optimized to just @1

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

Bug ID: 101339
   Summary: (bit_and (negate (convert thurth_value@1))
integer_onep) is not optimized to just @1
   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: ---

Take:
int f(int a, int b)
{
  _Bool c = a == b;
  int t = c;
  int t1 = -t;
  return t1 & 1;
}
 CUT ---
This is not optimized to just "return (int)(a == b)" at the gimple level

[Bug tree-optimization/101339] (bit_and (negate (convert thurth_value@1)) integer_onep) is not optimized to just @1

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

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2021-07-06
   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
 Status|UNCONFIRMED |ASSIGNED

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

bug with pointer alias

2021-07-06 Thread Ali Thari via Gcc-bugs
Dear GCC

I think there is a problem with using pointer aliases with gfortan, something 
that does not appear on ifort nor ftn (Cray)


I did initially post my problem on stackoverflow with a minimal example:
What is wrong with this fortran code using pointer aliases - Stack 
Overflow


The code is attached.


I  tested with version 9.3 and 10.1


Best
Ali


md_ptr.f90
Description: md_ptr.f90


test_ptr.f90
Description: test_ptr.f90


[Bug target/101325] [12 Regression] arm: Wrong code with MVE vcmpeqq intrinsic since r12-671-gd083fbf72

2021-07-06 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101325

Alex Coplan  changed:

   What|Removed |Added

Summary|[12 Regression] arm: Wrong  |[12 Regression] arm: Wrong
   |code with MVE vcmpeqq   |code with MVE vcmpeqq
   |intrinsic   |intrinsic since
   ||r12-671-gd083fbf72
 CC||clyon at gcc dot gnu.org

--- Comment #2 from Alex Coplan  ---
Started with r12-671-gd083fbf72d4533d2009c725524983e1184981e74:

commit d083fbf72d4533d2009c725524983e1184981e74
Author: Christophe Lyon 
Date:   Mon May 10 13:52:02 2021

arm: MVE: Factorize all vcmp* integer patterns

[Bug tree-optimization/101339] (bit_and (negate (convert thurth_value@1)) integer_onep) is not optimized to just @1

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101339

--- Comment #2 from Richard Biener  ---
And

int f(int a, int b)
{
  _Bool c = a == b;
  int t = c;
  int t1 = t + 1;
  return t1 & 1;
}

is not optimized to return (int)a != b either (for any odd add).  Addition
of even adds is handled though.

[Bug target/101325] [12 Regression] arm: Wrong code with MVE vcmpeqq intrinsic since r12-671-gd083fbf72

2021-07-06 Thread clyon at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101325

Christophe Lyon  changed:

   What|Removed |Added

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

--- Comment #3 from Christophe Lyon  ---
I will have a look

[Bug bootstrap/100246] [11/12 Regression] GCC will not bootstrap with clang 3.4/3.5 [xcode 5/6, Darwin 12/13]

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

--- Comment #8 from CVS Commits  ---
The master branch has been updated by Iain D Sandoe :

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

commit r12-2052-gf99f6eb58e1f894dae024f63cc2fe30fa7605e59
Author: Iain Sandoe 
Date:   Sat Jul 3 19:47:48 2021 +0100

X86: Provide a CTOR for stringop_algs [PR100246].

Several older compilers fail to build modern GCC because of missing
or incomplete C++11 support.

Signed-off-by: Iain Sandoe 

PR bootstrap/100246 - [11/12 Regression] GCC will not bootstrap with clang
3.4/3.5 [xcode 5/6, Darwin 12/13]

PR bootstrap/100246

gcc/ChangeLog:

* config/i386/i386.h (struct stringop_algs): Define a CTOR for
this type.

[Bug tree-optimization/101340] New: SLP discovery via vect_slp_linearize_chain is imperfect

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101340

Bug ID: 101340
   Summary: SLP discovery via vect_slp_linearize_chain is
imperfect
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

For polyhedron capacita we have the hot fourir routine which with -ffast-math
suffers from reassoc perturbing the SLP lanes to not match.  SLP discovery
reassociation could help here but it's limited by the single_use check.

For loop vect we could allow uses outside of the chain but of course we
do not want to expand multi-uses inside.  That doesn't fit well with the
simple worklist approach but would need sth more elaborate.

[Bug tree-optimization/101340] SLP discovery via vect_slp_linearize_chain is imperfect

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101340

--- Comment #1 from Richard Biener  ---
Created attachment 51108
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51108&action=edit
testcase for the testsuite

[Bug tree-optimization/101340] SLP discovery via vect_slp_linearize_chain is imperfect

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101340

--- Comment #2 from Richard Biener  ---
Patch that breaks for example gfortran.dg/PR100120.f90 because it expands
multi-uses inside a chain:

diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 2813b3dbe91..0c93be8e4d5 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1491,7 +1491,11 @@ vect_slp_linearize_chain (vec_info *vinfo,
  gimple *use_stmt;
  use_operand_p use_p;
  if (dt == vect_internal_def
- && single_imm_use (op, &use_p, &use_stmt)
+ /* For the loop SLP discovery case associate across multiple
+uses as well, for BB vect avoid this since live lane
+handling is not good enough yet.  */
+ && (is_a  (vinfo)
+ || single_imm_use (op, &use_p, &use_stmt))
  && is_gimple_assign (def_stmt_info->stmt)
  && (gimple_assign_rhs_code (def_stmt_info->stmt) == code
  || (code == PLUS_EXPR

[Bug target/98321] [nvptx] 'atom.add.f32' for atomic add of 32-bit 'float'

2021-07-06 Thread tschwinge at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98321

Thomas Schwinge  changed:

   What|Removed |Added

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

--- Comment #6 from Thomas Schwinge  ---
Seems this will be a bigger task:
 "Atomic
operations on floating-point data types".

[Bug gcov-profile/101341] New: [Gcov] Wrong coverage with "for(;;a++)" loop statement

2021-07-06 Thread byone.heng at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101341

Bug ID: 101341
   Summary: [Gcov] Wrong coverage with "for(;;a++)"  loop
statement
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: gcov-profile
  Assignee: unassigned at gcc dot gnu.org
  Reporter: byone.heng at gmail dot com
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

$./gcc -v   
Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/home/x/project/gcc/build/install/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/x/project/gcc/build/install
--enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20210105 (experimental) (GCC)

$cat test.c
volatile long int true_var = 1;
const long int false_var = 0;
int a=0;
int main() {
  for (;; a++) {
int c[1];
if( true_var > 0 )
{
if (a) {
  break;
  a;
  continue; /* count(1) */
}
continue;
} /* count(1) */
  }
  return 0;
}

$gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov

-:1:/* { dg-options "-fprofile-arcs -ftest-coverage" } */
-:2:/* { dg-do run { target native } } */
-:3:
-:4:volatile long int true_var = 1;
-:5:const long int false_var = 0;
-:6:
-:7:int a=0;
-:8:
2:9:int main() {
1:   10:  for (;; a++) {
-:   11:int c[1];
2:   12:if( true_var > 0 )
-:   13:{
2:   14:if (a) {
1:   15:  break;
-:   16:  a;
1:   17:  continue; /* count(1) */
-:   18:}
1:   19:continue;
-:   20:} /* count(1) */
-:   21:  }
-:   22:
1:   23:  return 0;
-:   24:}
-:   25:
-:   26:/* { dg-final { run-gcov gcov-pr85217.c } } */

Line 10 is wrongly marked as executed once which should be executed twice.

[Bug gcov-profile/101342] New: [Gcov] Wrong coverage with "for(;;a++)" loop statement

2021-07-06 Thread byone.heng at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101342

Bug ID: 101342
   Summary: [Gcov] Wrong coverage with "for(;;a++)"  loop
statement
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: gcov-profile
  Assignee: unassigned at gcc dot gnu.org
  Reporter: byone.heng at gmail dot com
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

$./gcc -v   
Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/home/x/project/gcc/build/install/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/x/project/gcc/build/install
--enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20210105 (experimental) (GCC)

$cat test.c
volatile long int true_var = 1;
const long int false_var = 0;
int a=0;
int main() {
  for (;; a++) {
int c[1];
if( true_var > 0 )
{
if (a) {
  break;
  a;
  continue; /* count(1) */
}
continue;
} /* count(1) */
  }
  return 0;
}

$gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov

-:1:/* { dg-options "-fprofile-arcs -ftest-coverage" } */
-:2:/* { dg-do run { target native } } */
-:3:
-:4:volatile long int true_var = 1;
-:5:const long int false_var = 0;
-:6:
-:7:int a=0;
-:8:
2:9:int main() {
1:   10:  for (;; a++) {
-:   11:int c[1];
2:   12:if( true_var > 0 )
-:   13:{
2:   14:if (a) {
1:   15:  break;
-:   16:  a;
1:   17:  continue; /* count(1) */
-:   18:}
1:   19:continue;
-:   20:} /* count(1) */
-:   21:  }
-:   22:
1:   23:  return 0;
-:   24:}
-:   25:
-:   26:/* { dg-final { run-gcov gcov-pr85217.c } } */

Line 10 is wrongly marked as executed once which should be executed twice.

[Bug gcov-profile/101342] [Gcov] wrong coverage for the function with a loop statement

2021-07-06 Thread byone.heng at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101342

Xiaoyuan Xie  changed:

   What|Removed |Added

Summary|[Gcov] Wrong coverage with  |[Gcov] wrong coverage for
   |"for(;;a++)"  loop  |the function with a loop
   |statement   |statement

--- Comment #1 from Xiaoyuan Xie  ---
$./gcc -v   
Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/home/x/project/gcc/build/install/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/x/project/gcc/build/install
--enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20210105 (experimental) (GCC)

$cat test.c
static short int true_var = 1;
signed char false_var = 0;
typedef unsigned V __attribute__ ((vector_size (16)));
V
foo (unsigned x, V v)
{
  do {
  v %= x;
  x = 1;
  } while (v[1]);
  return v;
}
int
main ()
{
  V x = foo (5, (V) { 0, 1 });
  if (x[0] || x[1] || x[2] || x[3])
__builtin_abort();
  return 0;
}


$gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov

-:1:/* { dg-do run } */
-:2:/* { dg-additional-options "-w -Wno-psabi" } */
-:3:
-:4:static short int true_var = 1;
-:5:signed char false_var = 0;
-:6:
-:7:typedef unsigned V __attribute__ ((vector_size (16)));
-:8:
-:9:V
2:   10:foo (unsigned x, V v)
-:   11:{
-:   12:  do {
2:   13:  v %= x;
2:   14:  x = 1;
2:   15:  } while (v[1]);
1:   16:  return v;
-:   17:}
-:   18:
-:   19:int
1:   20:main ()
-:   21:{
1:   22:  V x = foo (5, (V) { 0, 1 });
1:   23:  if (x[0] || x[1] || x[2] || x[3])
#:   24:__builtin_abort();
1:   25:  return 0;
-:   26:}

In my opinion, line 10 should be executed one time.

[Bug c++/101343] New: ICE in tsubst_copy, at cp/pt.c:15732

2021-07-06 Thread tim at ngus dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101343

Bug ID: 101343
   Summary: ICE in tsubst_copy, at cp/pt.c:15732
   Product: gcc
   Version: 9.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tim at ngus dot net
  Target Milestone: ---

* the exact version of GCC;

$ g++-9 --version
g++-9 (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

* the system type;

See above.

* the options given when GCC was configured/built;

Don't know how to get those.

* the complete command line that triggers the bug;

/usr/bin/g++-9  -DAPP_MAJOR_VERSION=1 -DAPP_MINOR_VERSION=0
-DAPP_URI=\"app.graphia\" -DBPLOG_MINIMUM_SEVERITY=SEVERITY_CRITICAL
-DCOPYRIGHT="\"(c) 2013-2021 Graphia Technologies Ltd.\""
-DCRYPTOPP_DISABLE_ASM -DPRODUCT_NAME=\"Graphia\" -DQCUSTOMPLOT_USE_LIBRARY
-DQCUSTOMPLOT_USE_OPENGL -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS
-DQT_DISABLE_DEPRECATED_BEFORE=0x06 -DQT_GUI_LIB -DQT_NETWORK_LIB
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_OPENGLEXTENSIONS_LIB
-DQT_OPENGL_LIB -DQT_PRINTSUPPORT_LIB -DQT_QMLMODELS_LIB -DQT_QML_DEBUG
-DQT_QML_LIB -DQT_QUICK_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB
-DSOURCE_DIR=\"/home/tim/sources/graphia/source/app\"
-DVERSION=\"dev-1490-gf6acac04-gha-restructure\" -D_DEBUG
-D__STDC_FORMAT_MACROS -Isource/app -I/home/tim/sources/graphia/source/app
-Isource/app/Graphia_autogen/include -I/home/tim/sources/graphia/source
-isystem /home/tim/sources/graphia/source/thirdparty -isystem
/home/tim/sources/graphia/source/thirdparty/blaze -isystem
/home/tim/sources/graphia/source/thirdparty/boost/spirit -isystem
/home/tim/sources/graphia/source/thirdparty/json -isystem
/home/tim/sources/graphia/source/thirdparty/hdf5 -isystem
/home/tim/sources/graphia/source/thirdparty/matio -isystem
/home/tim/sources/graphia/source/thirdparty/zlib -isystem
/home/tim/sources/graphia/source/thirdparty/qcustomplot -isystem
/home/tim/sources/graphia/source/thirdparty/breakpad/src -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtCore -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/./mkspecs/linux-g++ -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtQml -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtNetwork -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtWidgets -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtGui -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtQuick -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtQmlModels -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtPrintSupport -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtXml -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtOpenGL -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtOpenGLExtensions -isystem
/home/tim/sdks/Qt/5.14.2/gcc_64/include/QtSvg -Wpedantic -Wall -Wextra
-Wcast-align -Wcast-qual -Wdisabled-optimization -Wformat=2 -Winit-self
-Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual
-Wnon-virtual-dtor -Wredundant-decls -Wshadow -funroll-loops -Wlogical-op
-Wstrict-null-sentinel -Wdouble-promotion
-DBUILD_SOURCE_DIR=\"/home/tim/sources/graphia\" -g -g   -fPIC -pthread
-std=gnu++17 -MD -MT source/app/CMakeFiles/Graphia.dir/graph/graphmodel.cpp.o
-MF source/app/CMakeFiles/Graphia.dir/graph/graphmodel.cpp.o.d -o
source/app/CMakeFiles/Graphia.dir/graph/graphmodel.cpp.o -c
/home/tim/sources/graphia/source/app/graph/graphmodel.cpp -save-temps

* the compiler output (error messages, warnings, etc.); and

In file included from
/home/tim/sources/graphia/source/app/graph/graphmodel.cpp:60:
/home/tim/sources/graphia/source/app/ui/visualisations/visualisationbuilder.h:
In instantiation of ‘void VisualisationsBuilder::build(const
Attribute&, const VisualisationChannel&, const VisualisationConfig&, int,
VisualisationInfo&) [with ElementId = NodeId]’:
/home/tim/sources/graphia/source/app/graph/graphmodel.cpp:738:98:   required
from here
/home/tim/sources/graphia/source/app/ui/visualisations/visualisationbuilder.h:179:90:
internal compiler error: in tsubst_copy, at cp/pt.c:15732
  179 | config.parameterValue(QStringLiteral("mapping")));
  |
 ^  
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

* the preprocessed file (*.i*) that triggers the bug, generated by
  adding -save-temps to the complete compilation command, or, in
  the case of a bug report for the GNAT front end, a complete set
  of source files (see below).

https://drive.google.com/file/d/1Y6tBZzV-EBI5olHt0sdMdf04TavFfRvY/view

[Bug target/101296] Addition of x86 addsub SLP patterned slowed down 433.milc by 12% on znver2 with -Ofast -flto

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101296

Richard Biener  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org

--- Comment #5 from Richard Biener  ---
OK, so some interesting difference is (that's all of the -fopt-info-vec
differences):

-s_m_a_mat.c:18:18: optimized: basic block part vectorized using 32 byte
vectors
-s_m_a_mat.c:18:18: optimized: basic block part vectorized using 32 byte
vectors
-s_m_a_mat.c:18:18: optimized: basic block part vectorized using 32 byte
vectors
-s_m_a_mat.c:18:18: optimized: basic block part vectorized using 32 byte
vectors
-s_m_a_mat.c:18:18: optimized: basic block part vectorized using 32 byte
vectors
+m_mat_nn.c:90:17: optimized: basic block part vectorized using 16 byte vectors

The +m_mat_nn.c:90:17 is mult_su3_nn while the -s_m_a_mat.c:18:18 is
scalar_mult_add_su3_matrix which is inlined at all call sites.   The cases
missing are all inlined into the function update_u.

The odd thing is that we're seeing changes in .vect of update_u like

@@ -3426,46 +3334,40 @@
   # DEBUG j => 0
   # DEBUG BEGIN_STMT
   # DEBUG BEGIN_STMT
-  _918 = MEM  [(struct su3_matrix
*)s_103].link[dir_67].e[0][0].real;
   _919 = temp1.e[0][0].real;
   _920 = t5_12 * _919;
-  _921 = _918 + _920;
+  _921 = _920 + _1023;
   temp2.e[0][0].real = _921;
   # DEBUG BEGIN_STMT
-  _923 = MEM  [(struct su3_matrix
*)s_103].link[dir_67].e[0][0].imag;
   _924 = temp1.e[0][0].imag;
   _925 = t5_12 * _924;
-  _926 = _923 + _925;
+  _926 = _925 + _1028;
...

which in the end result in less DRs into SLP and thus a different outcome
there.
This difference starts in the cunrolli dump!?  Dump differences are like

+ipa-modref: call stmt mult_su3_nn (&htemp, link_24, &temp1);
+ipa-modref: call to mult_su3_nn/1705 does not clobber base: temp2 alias sets:
6->5
...
 Value numbering stmt = _938 = link_24->e[i_915][2].real;
-Setting value number of _938 to _938 (changed)
-Making available beyond BB152 _938 for value _938
+ipa-modref: call stmt mult_su3_nn (&htemp, &temp2, &temp1);
+ipa-modref: call to mult_su3_nn/1705 does not clobber base: MEM 
[(struct su3_matrix *)s_5] alias sets: 6->5
+ipa-modref: call stmt mult_su3_nn (&htemp, link_24, &temp1);
+ipa-modref: call to mult_su3_nn/1705 does not clobber base: MEM 
[(struct su3_matrix *)s_5] alias sets: 6->5
+Setting value number of _938 to _1043 (changed)
+_1043 is available for _1043
+Replaced link_24->e[i_915][2].real with _1043 in all uses of _938 =
link_24->e[i_915][2].real;

it's really odd, the WPA and LTRANS modref dumps do not show any difference
but the above looks like IPA summary is once available and once not.  Ah,
the late modref pass results spill over and it looks like we "improve" here:

   loads:
 Limits: 32 bases, 16 refs
-  Base 0: alias set 6
+  Base 0: alias set 5
+Ref 0: alias set 5
+  Every access
+  Base 1: alias set 6
 Ref 0: alias set 5
   Every access
   stores:
 Limits: 32 bases, 16 refs
-  Base 0: alias set 6
+  Base 0: alias set 5
 Ref 0: alias set 5
-  Every access
+  access: Parm 2 param offset:0 offset:0 size:128 max_size:128
+  access: Parm 2 param offset:16 offset:0 size:128 max_size:128
+  access: Parm 2 param offset:48 offset:0 size:128 max_size:128
+  access: Parm 2 param offset:64 offset:0 size:128 max_size:128
+  access: Parm 2 param offset:112 offset:0 size:128 max_size:128
+  Base 1: alias set 6
+Ref 0: alias set 5
+  access: Parm 2 param offset:0 offset:256 size:64 max_size:64
+  access: Parm 2 param offset:0 offset:320 size:64 max_size:64
+  access: Parm 2 param offset:0 offset:640 size:64 max_size:64
+  access: Parm 2 param offset:0 offset:704 size:64 max_size:64
+  access: Parm 2 param offset:0 offset:768 size:64 max_size:64
+  access: Parm 2 param offset:0 offset:832 size:64 max_size:64
+  access: Parm 2 param offset:0 offset:1024 size:64 max_size:64
+  access: Parm 2 param offset:0 offset:1088 size:64 max_size:64
   parm 0 flags: nodirectescape
   parm 1 flags: nodirectescape
   parm 2 flags: direct noescape nodirectescape
 void mult_su3_nn (struct su3_matrix * a, struct su3_matrix * b, struct
su3_matrix * c)

I'm not sure what "Every access" means but I suppose it's "bad" here.  Maybe
it's

  - Analyzing load: b_10(D)->e[2][1].real
- Recording base_set=6 ref_set=5 parm=1
---param param=modref-max-accesses limit reached
  - Analyzing load: b_10(D)->e[2][1].imag
- Recording base_set=6 ref_set=5 parm=1
... (a lot) ...
+--param param=modref-max-accesses limit reached
  - Analyzing load: a_7(D)->e[1][1].imag
- Recording base_set=6 ref_set=5 parm=0
  - ECF_CONST | ECF_NOVOPS, ignoring all stores and all loads except for args.

so eventually vectorizing he

[Bug target/100269] [12 Regression] i686 biarch compiler fails for Darwin after r12-36.

2021-07-06 Thread iains at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100269

Iain Sandoe  changed:

   What|Removed |Added

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

--- Comment #3 from Iain Sandoe  ---
fixed.

[Bug gcov-profile/101342] [Gcov] wrong coverage for the function with a loop statement

2021-07-06 Thread byone.heng at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101342

--- Comment #2 from Xiaoyuan Xie  ---
I clicked the wrong button on my page and the same content was submitted twice,
please ignore the content in the description and directly read the comments 1.

[Bug target/101324] powerpc64le: hashst appears before mflr at -O1 or higher

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

Segher Boessenkool  changed:

   What|Removed |Added

 CC||mliska at suse dot cz

--- Comment #3 from Segher Boessenkool  ---
Cc:ing Martin because this is options stuff.

[Bug sanitizer/100439] stack overflow running ubsan

2021-07-06 Thread florin.iucha at amd dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100439

--- Comment #13 from Florin Iucha  ---
With GCC 11-20210703 snapshot I can reproduce the observation on Ubuntu 20.04
but can not reproduce the observation on Debian testing.

[Bug tree-optimization/101301] Improving sparse switch statement

2021-07-06 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101301

--- Comment #8 from Thomas Koenig  ---
(In reply to Segher Boessenkool from comment #7)

> Yeah :-)  Of course in your testing the nine named cases have the same
> probability,
> which is not very true in practice (but is there any better guess possible),
> and
> the "default" case has that same probability for GCC (is there a better
> estimate
> for that, maybe?)

I think that we should leave something to do for the hardware branch
predictors.  Any pattern should lead to better predictions. The test
case is rather brutal because it is random.

> (I expect there just is some typo or thinko somewhere in the pass, fwiw :-) )

As I have demonstrated above, such a thinko is rather easy to make :-)

[Bug target/101324] powerpc64le: hashst appears before mflr at -O1 or higher

2021-07-06 Thread tuliom at ascii dot art.br via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101324

Tulio Magno Quites Machado Filho  changed:

   What|Removed |Added

  Attachment #51105|0   |1
is obsolete||

--- Comment #4 from Tulio Magno Quites Machado Filho  ---
Created attachment 51109
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51109&action=edit
__memmove_ppc extracted from glibc (without -g3)

I removed -g3 from the command that generated memmove-ppc64.i.
I think this won't generate warnings now.

[Bug gcov-profile/101341] [Gcov] Wrong coverage with "for(;;a++)" loop statement

2021-07-06 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101341

Andreas Schwab  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|UNCONFIRMED |RESOLVED

--- Comment #1 from Andreas Schwab  ---
.

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

[Bug gcov-profile/101342] [Gcov] wrong coverage for the function with a loop statement

2021-07-06 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101342

--- Comment #3 from Andreas Schwab  ---
*** Bug 101341 has been marked as a duplicate of this bug. ***

[Bug c++/101344] New: braced-init-list not supported in an aggregate deduction

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

Bug ID: 101344
   Summary: braced-init-list not supported in an aggregate
deduction
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

Please consider the program as follows. GCC correctly initializes struct A, but
in more simple case of struct B it fails:

```
template
struct A { T t[N]; };

template
struct B { T t[2]; };

int main()
{
   A a{{1, 2}}; // ok in gcc
   B b{{1, 2}}; // error in gcc (ok in other compilers, e.g. msvc)
   return a.t[0];
}
```

I believe, struct B initialization shall work here same way.

[Bug tree-optimization/101301] Improving sparse switch statement

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

--- Comment #9 from Segher Boessenkool  ---
(In reply to Thomas Koenig from comment #8)
> (In reply to Segher Boessenkool from comment #7)
>  
> > Yeah :-)  Of course in your testing the nine named cases have the same
> > probability,
> > which is not very true in practice (but is there any better guess possible),
> > and
> > the "default" case has that same probability for GCC (is there a better
> > estimate
> > for that, maybe?)
> 
> I think that we should leave something to do for the hardware branch
> predictors.  Any pattern should lead to better predictions. The test
> case is rather brutal because it is random.

Heh.  My question is if we would get better code if we assumed the default case
is more likely than the other cases, in general, on actual code "in the wild".
There is bound to be some literature about that, hrm...

> > (I expect there just is some typo or thinko somewhere in the pass, fwiw :-) 
> > )
> 
> As I have demonstrated above, such a thinko is rather easy to make :-)

Ha :-)  Too bad we can only warn "invalid sum of incoming frequencies", it
still
happens too often (read: at all) to actually error on it...  that would perhaps
grab people's attention :-)

[Bug target/101345] New: wrong code at -O1 with vector modulo

2021-07-06 Thread zsojka at seznam dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101345

Bug ID: 101345
   Summary: wrong code at -O1 with vector modulo
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: wrong-code
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zsojka at seznam dot cz
  Target Milestone: ---
  Host: x86_64-pc-linux-gnu
Target: powerpc64le-unknown-linux-gnu

Created attachment 51110
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51110&action=edit
reduced testcase

Output:
$ powerpc64le-unknown-linux-gnu-gcc -O testcase.c -static
$ qemu-ppc64le -- ./a.out 
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted

The value is 0x2828282828282828 instead of 0x1414141414141414
Already the computed value of "y" is wrong.

subfic 10,10,4   # tmp160, tmp159,

looks wrong, if replaced by

subfic 10,10,2   # tmp160, tmp159,

the code works correctly

$ powerpc64le-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-powerpc64le/bin/powerpc64le-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-2049-20210706092228-gb019b28ebd6-checking-yes-rtl-df-extra-powerpc64le/bin/../libexec/gcc/powerpc64le-unknown-linux-gnu/12.0.0/lto-wrapper
Target: powerpc64le-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl
--with-sysroot=/usr/powerpc64le-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=powerpc64le-unknown-linux-gnu
--with-ld=/usr/bin/powerpc64le-unknown-linux-gnu-ld
--with-as=/usr/bin/powerpc64le-unknown-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r12-2049-20210706092228-gb019b28ebd6-checking-yes-rtl-df-extra-powerpc64le
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20210706 (experimental) (GCC)

[Bug c/101346] New: ICE: maximum number of generated reload insns per insn achieved (90)

2021-07-06 Thread gscfq--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101346

Bug ID: 101346
   Summary: ICE: maximum number of generated reload insns per insn
achieved (90)
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gs...@t-online.de
  Target Milestone: ---

Affects versions down to at least r5 :


$ cat z1.c
_Decimal128
foo (_Decimal128 x)
{
  return - __builtin_fabsd128 (x);
}


$ gcc-12-20210704 -c z1.c -O0 -m32 -fprofile-generate
during RTL pass: reload
z1.c: In function 'foo':
z1.c:5:1: internal compiler error: maximum number of generated reload insns per
insn achieved (90)
5 | }
  | ^
0xa84c98 lra_constraints(bool)
../../gcc/lra-constraints.c:5091
0xa72932 lra(_IO_FILE*)
../../gcc/lra.c:2336
0xa2d499 do_reload
../../gcc/ira.c:5822
0xa2d499 execute
../../gcc/ira.c:6008

[Bug target/97194] optimize vector element set/extract at variable position

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

--- Comment #25 from CVS Commits  ---
The master branch has been updated by Uros Bizjak :

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

commit r12-2085-gf65878178ab05180a5937f11f8fdb755678a82ce
Author: Uros Bizjak 
Date:   Tue Jul 6 19:27:34 2021 +0200

i386: Add variable vec_set for 32bit vectors [PR97194]

To generate sane code a SSE4.1 variable PBLENDV instruction is needed.

Also enable variable vec_set through vec_setm_operand predicate
for TARGET_SSE4_1 instead of TARGET_AVX2. 
ix86_expand_vector_init_duplicate
is able to emulate vpbroadcast{b,w} with pxor/pshufb.

2021-07-06  Uroš Bizjak  

gcc/
PR target/97194
* config/i386/predicates.md (vec_setm_operand): Enable
register_operand for TARGET_SSE4_1.
* config/i386/mmx.md (vec_setv2hi): Use vec_setm_operand
as operand 2 predicate.  Call ix86_expand_vector_set_var
for non-constant index operand.
(vec_setv4qi): Use vec_setm_mmx_operand as operand 2 predicate.
Call ix86_expand_vector_set_var for non-constant index operand.

gcc/testsuite/

PR target/97194
* gcc.target/i386/sse4_1-vec-set-1a.c: New test.
* gcc.target/i386/sse4_1-vec-set-2a.c: Ditto.

[Bug c/101347] New: [11/12 Regression] ICE in cfg_layout_initialize, at cfgrtl.c:4478

2021-07-06 Thread gscfq--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101347

Bug ID: 101347
   Summary: [11/12 Regression] ICE in cfg_layout_initialize, at
cfgrtl.c:4478
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gs...@t-online.de
  Target Milestone: ---

Testcase reduced from pr26983.c :
(seen with cet-sjlj-6a.c, cet-sjlj-6b.c, setjmp-1.c, pr26983.c)


$ cat z1.c
void *jmpbuf[6];
void
foo (void)
{
  __builtin_setjmp (jmpbuf);
}


$ gcc-12-20210704 -c z1.c -O2 -fprofile-generate -fprofile-use
z1.c: In function 'foo':
z1.c:6:1: warning: 'z1.gcda' profile count data file not found
[-Wmissing-profile]
6 | }
  | ^
during RTL pass: into_cfglayout
z1.c:6:1: internal compiler error: Segmentation fault
0xdcbcdf crash_signal
../../gcc/toplev.c:328
0x8c9a5b cfg_layout_initialize(int)
../../gcc/cfgrtl.c:4478
0x8c9bba execute
../../gcc/cfgrtl.c:3685

[Bug fortran/101348] New: ICE in gfc_get_nodesc_array_type, at fortran/trans-types.c:1697

2021-07-06 Thread gscfq--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101348

Bug ID: 101348
   Summary: ICE in gfc_get_nodesc_array_type, at
fortran/trans-types.c:1697
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gs...@t-online.de
  Target Milestone: ---

Affects versions down to at least r5 :


$ cat z1.f90
module m
   integer :: a(1)[1:,:]
end


$ cat z2.f90
program p
   integer :: a(1)[1:,:]
end


$ gfortran-12-20210704 -c z2.f90 -fcoarray=lib   # accepted
$
$ gfortran-12-20210704 -c z1.f90 -fcoarray=lib
f951: internal compiler error: Segmentation fault
0xc93c2f crash_signal
../../gcc/toplev.c:328
0x82bedc gfc_get_nodesc_array_type(tree_node*, gfc_array_spec*, gfc_packed,
bool)
../../gcc/fortran/trans-types.c:1697
0x7cf376 gfc_get_symbol_decl(gfc_symbol*)
../../gcc/fortran/trans-decl.c:1797
0x7d25c8 gfc_create_module_variable
../../gcc/fortran/trans-decl.c:5359
0x790e12 do_traverse_symtree
../../gcc/fortran/symbol.c:4170
0x7d2dcb gfc_generate_module_vars(gfc_namespace*)
../../gcc/fortran/trans-decl.c:5858
0x7ad0d4 gfc_generate_module_code(gfc_namespace*)
../../gcc/fortran/trans.c:2303
0x759421 translate_all_program_units
../../gcc/fortran/parse.c:6451
0x759421 gfc_parse_file()
../../gcc/fortran/parse.c:6733
0x7a5c4f gfc_be_parse_file
../../gcc/fortran/f95-lang.c:216

[Bug fortran/101328] ICE in conv_array_index_offset, at fortran/trans-array.c:3425

2021-07-06 Thread gscfq--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101328

--- Comment #1 from G. Steinmetz  ---

Additional cases :


$ cat z3.f90
module m
   type t
  integer :: a = 1
   end type
contains
   subroutine s(x)
  type(t), intent(out) :: x(..)
   end
end


$ cat z5.f90
module m
   type t
  integer :: a
  integer :: b = 1
   end type
contains
   subroutine s(x)
  type(t), intent(out) :: x(..)
   end
end


$ cat zz1.f90
program p
   type t(n)
  integer, len :: n = 1
  integer :: a = 1
  integer :: b(n) = 1
   end type
contains
   subroutine s(x)
  type(t(2)), intent(out) :: x(..)
   end
end

[Bug sanitizer/100439] stack overflow running ubsan

2021-07-06 Thread florin.iucha at amd dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100439

--- Comment #14 from Florin Iucha  ---
Bisecting the configure flags, I think I narrowed it down to: it fails when
"--enable-gnu-indirect-function" is present.

[Bug fortran/101349] New: ICE in gfc_get_descriptor_field, at fortran/trans-array.c:140

2021-07-06 Thread gscfq--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101349

Bug ID: 101349
   Summary: ICE in gfc_get_descriptor_field, at
fortran/trans-array.c:140
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gs...@t-online.de
  Target Milestone: ---

With a missing attribute allocatable or pointer :
(affects version down to r6)


$ cat z1.f90
subroutine s(x)
   class(*) :: x(:)
   allocate (x, source=['abc'])
end


$ cat z2.f90   # ok
subroutine s(x)
   class(*), allocatable :: x(:)
   allocate (x, source=['abc'])
end


$ gfortran-12-20210704 -c z1.f90
z1.f90:3:31:

3 |allocate (x, source=['abc'])
  |   1
internal compiler error: in gfc_get_descriptor_field, at
fortran/trans-array.c:140
0x7ad4f0 gfc_get_descriptor_field
../../gcc/fortran/trans-array.c:140
0x7ae7bf gfc_conv_descriptor_dtype(tree_node*)
../../gcc/fortran/trans-array.c:215
0x7b46d0 gfc_array_init_size
../../gcc/fortran/trans-array.c:5562
0x7b46d0 gfc_array_allocate(gfc_se*, gfc_expr*, tree_node*, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, gfc_expr*, tree_node*, bool)
../../gcc/fortran/trans-array.c:5982
0x8256b7 gfc_trans_allocate(gfc_code*)
../../gcc/fortran/trans-stmt.c:6736
0x7acb47 trans_code
../../gcc/fortran/trans.c:2090
0x7d31a4 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6898
0x759926 translate_all_program_units
../../gcc/fortran/parse.c:6464
0x759926 gfc_parse_file()
../../gcc/fortran/parse.c:6733
0x7a5c4f gfc_be_parse_file
../../gcc/fortran/f95-lang.c:216

[Bug fortran/101350] New: ICE in build_function_decl, at fortran/trans-decl.c:2376

2021-07-06 Thread gscfq--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101350

Bug ID: 101350
   Summary: ICE in build_function_decl, at
fortran/trans-decl.c:2376
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gs...@t-online.de
  Target Milestone: ---

A name clash affects versions down to at least r5 :


$ cat z1.f90
module m
   external s
contains
   subroutine s
   end
end


$ gfortran-12-20210704 -c z1.f90
f951: internal compiler error: in build_function_decl, at
fortran/trans-decl.c:2376
0x7c7f39 build_function_decl
../../gcc/fortran/trans-decl.c:2376
0x7cd966 gfc_create_function_decl(gfc_namespace*, bool)
../../gcc/fortran/trans-decl.c:3090
0x7ad107 gfc_generate_module_code(gfc_namespace*)
../../gcc/fortran/trans.c:2314
0x759421 translate_all_program_units
../../gcc/fortran/parse.c:6451
0x759421 gfc_parse_file()
../../gcc/fortran/parse.c:6733
0x7a5c4f gfc_be_parse_file
../../gcc/fortran/f95-lang.c:216

[Bug fortran/101327] ICE in find_array_element, at fortran/expr.c:1355

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

kargl at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #1 from kargl at gcc dot gnu.org ---
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index b11ae7ce5c5..d370fba9616 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -1351,8 +1351,13 @@ find_array_element (gfc_constructor_base base,
gfc_array_ref *ar,
  goto depart;
}

-  gcc_assert (ar->as->upper[i]->expr_type == EXPR_CONSTANT
- && ar->as->lower[i]->expr_type == EXPR_CONSTANT);
+  if (ar->as->upper[i]->expr_type != EXPR_CONSTANT
+ || ar->as->lower[i]->expr_type != EXPR_CONSTANT)
+   {
+ t = false;
+ cons = NULL;
+ goto depart;
+   }

   /* Check the bounds.  */
   if ((ar->as->upper[i]

[Bug c/101346] ICE: maximum number of generated reload insns per insn achieved (90)

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

--- Comment #1 from Uroš Bizjak  ---
(In reply to G. Steinmetz from comment #0)

> $ gcc-12-20210704 -c z1.c -O0 -m32 -fprofile-generate

Also needs -msse.

It looks that:

(insn 38 37 39 6 (set (subreg:SI (reg:TD 83 [ _2 ]) 0)
(subreg:SI (reg:TD 82 [ _1 ]) 0)) "pr101346.c":4:10 75
{*movsi_internal}
 (nil))

causes reload loop.

[Bug fortran/101349] ICE in gfc_get_descriptor_field, at fortran/trans-array.c:140

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

kargl at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #1 from kargl at gcc dot gnu.org ---
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 45c3ad387ac..8365eb4caa8 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -7820,8 +7820,9 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code, bool
*array_alloc_wo_spec)
}
 }

-  /* Check for F08:C628.  */
-  if (allocatable == 0 && pointer == 0 && !unlimited)
+  /* F08:C628.  (R632) Each allocate-object shall be a data pointer or
+ an allocatable variable.  */
+  if (allocatable == 0 && pointer == 0)
 {
   gfc_error ("Allocate-object at %L must be ALLOCATABLE or a POINTER",
 &e->where);

[Bug rtl-optimization/101347] [11/12 Regression] ICE in cfg_layout_initialize with __builtin_setjmp and -fprofile-generate -fprofile-use

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

Andrew Pinski  changed:

   What|Removed |Added

Summary|[11/12 Regression] ICE in   |[11/12 Regression] ICE in
   |cfg_layout_initialize, at   |cfg_layout_initialize with
   |cfgrtl.c:4478   |__builtin_setjmp and
   ||-fprofile-generate
   ||-fprofile-use
   Target Milestone|--- |11.2

[Bug libstdc++/100900] error: missing 'typename' prior to dependent type name in elements_view

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

--- Comment #10 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Patrick Palka
:

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

commit r10-9969-ge9fbf0f9d621213ea16713b595feb88b789a8858
Author: Avi Kivity 
Date:   Mon Jun 7 11:19:05 2021 -0400

libstdc++: add missing typename for dependent type in ranges::elements_view
[PR100900]

Clang complains about the missing typename. I believe it's not required
in a more complete implementation of C++, but it's nicer to support
less complete implementations.

PR libstdc++/100900

libstdc++-v3/ChangeLog:

* include/std/ranges (elements_view::__iter_cat::_S_iter_cat):
Add missing typename.

(cherry picked from commit 5e2e15f212e2458a1258b8c856895c755460bc6b)

[Bug middle-end/98871] Cannot silence -Wmaybe-uninitialized at declaration site

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

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

https://gcc.gnu.org/g:6d3bab5d5adb3e28ddb16c97b0831efdea23cf7d

commit r12-2087-g6d3bab5d5adb3e28ddb16c97b0831efdea23cf7d
Author: Martin Sebor 
Date:   Tue Jul 6 13:41:02 2021 -0600

Improve warning suppression for inlined functions.

Resolves:
PR middle-end/98871 - Cannot silence -Wmaybe-uninitialized at declaration
site
PR middle-end/98512 - #pragma GCC diagnostic ignored ineffective in
conjunction with alias attribute

gcc/ChangeLog:

* builtins.c (warn_string_no_nul): Remove %G.
(maybe_warn_for_bound): Same.
(warn_for_access): Same.
(check_access): Same.
(check_strncat_sizes): Same.
(expand_builtin_strncat): Same.
(expand_builtin_strncmp): Same.
(expand_builtin): Same.
(expand_builtin_object_size): Same.
(warn_dealloc_offset): Same.
(maybe_emit_free_warning): Same.
* calls.c (maybe_warn_alloc_args_overflow): Same.
(maybe_warn_nonstring_arg): Same.
(maybe_warn_rdwr_sizes): Same.
* expr.c (expand_expr_real_1): Remove %K.
* gimple-fold.c (gimple_fold_builtin_strncpy): Remove %G.
(gimple_fold_builtin_strncat): Same.
* gimple-ssa-sprintf.c (format_directive): Same.
(handle_printf_call): Same.
* gimple-ssa-warn-alloca.c (pass_walloca::execute): Same.
* gimple-ssa-warn-restrict.c (maybe_diag_overlap): Same.
(maybe_diag_access_bounds): Same.  Call gimple_location.
(check_bounds_or_overlap): Same.
* trans-mem.c (ipa_tm_scan_irr_block): Remove %K.  Simplify.
* tree-ssa-ccp.c (pass_post_ipa_warn::execute): Remove %G.
* tree-ssa-strlen.c (maybe_warn_overflow): Same.
(maybe_diag_stxncpy_trunc): Same.
(handle_builtin_stxncpy_strncat): Same.
(maybe_warn_pointless_strcmp): Same.
* tree-ssa-uninit.c (maybe_warn_operand): Same.

gcc/testsuite/ChangeLog:

* gcc.dg/Wobjsize-1.c: Prune expected output.
* gcc.dg/Warray-bounds-71.c: New test.
* gcc.dg/Warray-bounds-71.h: New test header.
* gcc.dg/Warray-bounds-72.c: New test.
* gcc.dg/Warray-bounds-73.c: New test.
* gcc.dg/Warray-bounds-74.c: New test.
* gcc.dg/Warray-bounds-75.c: New test.
* gcc.dg/Wfree-nonheap-object-4.c: Adjust expected output.
* gcc.dg/Wfree-nonheap-object-5.c: New test.
* gcc.dg/Wfree-nonheap-object-6.c: New test.
* gcc.dg/pragma-diag-10.c: New test.
* gcc.dg/pragma-diag-9.c: New test.
* gcc.dg/uninit-suppress_3.c: New test.
* gcc.dg/pr79214.c: Xfail tests.
* gcc.dg/tree-ssa/builtin-sprintf-warn-27.c: New test.
* gcc.dg/format/c90-printf-1.c: Adjust expected output.

[Bug tree-optimization/98512] [11/12 Regression] “#pragma GCC diagnostic ignored” ineffective in conjunction with alias attribute

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

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

https://gcc.gnu.org/g:6d3bab5d5adb3e28ddb16c97b0831efdea23cf7d

commit r12-2087-g6d3bab5d5adb3e28ddb16c97b0831efdea23cf7d
Author: Martin Sebor 
Date:   Tue Jul 6 13:41:02 2021 -0600

Improve warning suppression for inlined functions.

Resolves:
PR middle-end/98871 - Cannot silence -Wmaybe-uninitialized at declaration
site
PR middle-end/98512 - #pragma GCC diagnostic ignored ineffective in
conjunction with alias attribute

gcc/ChangeLog:

* builtins.c (warn_string_no_nul): Remove %G.
(maybe_warn_for_bound): Same.
(warn_for_access): Same.
(check_access): Same.
(check_strncat_sizes): Same.
(expand_builtin_strncat): Same.
(expand_builtin_strncmp): Same.
(expand_builtin): Same.
(expand_builtin_object_size): Same.
(warn_dealloc_offset): Same.
(maybe_emit_free_warning): Same.
* calls.c (maybe_warn_alloc_args_overflow): Same.
(maybe_warn_nonstring_arg): Same.
(maybe_warn_rdwr_sizes): Same.
* expr.c (expand_expr_real_1): Remove %K.
* gimple-fold.c (gimple_fold_builtin_strncpy): Remove %G.
(gimple_fold_builtin_strncat): Same.
* gimple-ssa-sprintf.c (format_directive): Same.
(handle_printf_call): Same.
* gimple-ssa-warn-alloca.c (pass_walloca::execute): Same.
* gimple-ssa-warn-restrict.c (maybe_diag_overlap): Same.
(maybe_diag_access_bounds): Same.  Call gimple_location.
(check_bounds_or_overlap): Same.
* trans-mem.c (ipa_tm_scan_irr_block): Remove %K.  Simplify.
* tree-ssa-ccp.c (pass_post_ipa_warn::execute): Remove %G.
* tree-ssa-strlen.c (maybe_warn_overflow): Same.
(maybe_diag_stxncpy_trunc): Same.
(handle_builtin_stxncpy_strncat): Same.
(maybe_warn_pointless_strcmp): Same.
* tree-ssa-uninit.c (maybe_warn_operand): Same.

gcc/testsuite/ChangeLog:

* gcc.dg/Wobjsize-1.c: Prune expected output.
* gcc.dg/Warray-bounds-71.c: New test.
* gcc.dg/Warray-bounds-71.h: New test header.
* gcc.dg/Warray-bounds-72.c: New test.
* gcc.dg/Warray-bounds-73.c: New test.
* gcc.dg/Warray-bounds-74.c: New test.
* gcc.dg/Warray-bounds-75.c: New test.
* gcc.dg/Wfree-nonheap-object-4.c: Adjust expected output.
* gcc.dg/Wfree-nonheap-object-5.c: New test.
* gcc.dg/Wfree-nonheap-object-6.c: New test.
* gcc.dg/pragma-diag-10.c: New test.
* gcc.dg/pragma-diag-9.c: New test.
* gcc.dg/uninit-suppress_3.c: New test.
* gcc.dg/pr79214.c: Xfail tests.
* gcc.dg/tree-ssa/builtin-sprintf-warn-27.c: New test.
* gcc.dg/format/c90-printf-1.c: Adjust expected output.

[Bug libstdc++/100900] error: missing 'typename' prior to dependent type name in elements_view

2021-07-06 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100900

Patrick Palka  changed:

   What|Removed |Added

   Target Milestone|11.2|10.4

--- Comment #11 from Patrick Palka  ---
(In reply to Dmitry V. Levin from comment #9)
> Since PR95983 fix was backported to gcc-10 (by commit
> 1cb39945993c89746b0347746bd1267de85cbc42), please backport this follow-up
> fix to gcc-10, too.

done

[Bug fortran/101350] ICE in build_function_decl, at fortran/trans-decl.c:2376

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

kargl at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #1 from kargl at gcc dot gnu.org ---
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 45c3ad387ac..897cfde3ed3 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -15307,6 +15308,15 @@ resolve_symbol (gfc_symbol *sym)
 return;
   sym->resolve_symbol_called = 1;

+  /* Symbol cannot have an external attribute and be a contained procedure. 
*/
+  if (sym->attr.external && sym->attr.contained)
+{
+  gfc_error ("Contained procedure %qs at %L conflicts with "
+"a previously declared EXTERNAL procedure",
+sym->name, &sym->declared_at);
+  return;
+}
+
   /* No symbol will ever have union type; only components can be unions.
  Union type declaration symbols have type BT_UNKNOWN but flavor FL_UNION
  (just like derived type declaration symbols have flavor FL_DERIVED). */

[Bug libfortran/101305] Bind(C): Problems with incorrect kinds/sizes in ISO_Fortran_binding.h and CFI_establish

2021-07-06 Thread sandra at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101305

--- Comment #1 from sandra at gcc dot gnu.org ---
There's also some overlap with PR 100917, relating to long double.  Getting rid
of the hard-coded kind/size assumptions will take care of at least the C side
of that issue.

[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf

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

--- Comment #15 from CVS Commits  ---
The master branch has been updated by Indu Bhagat :

https://gcc.gnu.org/g:151b423a82f4bf15e3225833028f5258ea254cb9

commit r12-2090-g151b423a82f4bf15e3225833028f5258ea254cb9
Author: Indu Bhagat 
Date:   Tue Jul 6 13:53:58 2021 -0700

dwarf2ctf: the unit of sou field location is bits [PR101283]

If the value of the DW_AT_data_member_location attribute is constant, the
associated unit is bytes. This patch amends incorrect behaviour which was
being
exercised with -gdwarf-2. This caused some of the failures as noted in PR
debug/101283 (specifically the BTF tests involving btm_offset).

The testcase ctf-struct-array-2.c was erroneously checking for the value of
ctm_offset in number of bytes.

The patch fixes the calculation of the field location value for a struct
member
in dwarf2ctf and adjusts the testcase. This patch also fixes some of the
failing tests as noted in PR debug/101283.

2021-07-06  Indu Bhagat  

gcc/ChangeLog:

PR debug/101283
* dwarf2ctf.c (ctf_get_AT_data_member_location): Multiply by 8 to
get
number of bits.

gcc/testsuite/ChangeLog:

PR debug/101283
* gcc.dg/debug/ctf/ctf-struct-array-2.c: Adjust the value in the
testcase.

[Bug c/101351] New: ICE on valid code with -O1: in lra_split_hard_reg_for, at lra-assigns.c:1837

2021-07-06 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101351

Bug ID: 101351
   Summary: ICE on valid code with -O1: in lra_split_hard_reg_for,
at lra-assigns.c:1837
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.t468jxVWYr-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210706 (experimental) [master revision
:e442981a9:a3543b5e8002c033b2304d7ac1d1e58218eebb51] (GCC)

$ cat mutant.c
foo() {
  register _Complex long a asm("rax");
  return a / 10;
}

$ gcc-trunk -w -O1 mutant.c
mutant.c: In function ‘foo’:
mutant.c:4:1: error: unable to find a register to spill
4 | }
  | ^
mutant.c:4:1: error: this is the insn:
(insn 6 19 7 2 (parallel [
(set (reg:DI 87)
(truncate:DI (lshiftrt:TI (mult:TI (sign_extend:TI (reg:DI 93
[91]))
(sign_extend:TI (reg:DI 88)))
(const_int 64 [0x40]
(clobber (reg:DI 93 [91]))
(clobber (reg:CC 17 flags))
]) "mutant.c":3:12 439 {*smuldi3_highpart_1}
 (expr_list:REG_UNUSED (reg:DI 93 [91])
(expr_list:REG_DEAD (reg:DI 88)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_EQUAL (truncate:DI (lshiftrt:TI (mult:TI
(sign_extend:TI (reg:DI 0 ax [ a ]))
(const_int 7378697629483820647
[0x6667]))
(const_int 64 [0x40])))
(nil))
during RTL pass: reload
mutant.c:4:1: internal compiler error: in lra_split_hard_reg_for, at
lra-assigns.c:1837
0x73f51f _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/rtl-error.c:108
0xd776e6 lra_split_hard_reg_for()
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/lra-assigns.c:1837
0xd71ba9 lra(_IO_FILE*)
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/lra.c:2412
0xd26c69 do_reload
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/ira.c:5822
0xd26c69 execute
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/ira.c:6008
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug target/100782] [11 Regression] sh4 ICEs on -O2 -fPIE -fstack-protector: internal compiler error: in curr_insn_transform, at lra-constraints.c:4132

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

--- Comment #4 from Sergei Trofimovich  ---
Bisected down to r11-4577

commit 44fbc9c6e02ca5b8f98f25b514ed7588e7ba733d
Author: Vladimir N. Makarov 
Date:   Fri Oct 30 15:05:22 2020 -0400

Take insn scratch RA requirements into account in IRA.

  The patch changes insn scratches which require registers for all
insn alternatives (in other words w/o X constraint in scratch
constraint string).  This is done before IRA staring its work.  LRA
still continue to change the rest scratches (with X constraint and in
insn created during IRA) into pseudos.  As before the patch at the end
of LRA work, spilled scratch pseudos (for which X constraint was
chosen) changed into scratches back.

[Bug tree-optimization/86650] -Warray-bounds missing inlining context

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

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

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

commit r12-2091-gee9a0e93156ff3d41450db74172abc8ae2471d1f
Author: Martin Sebor 
Date:   Tue Jul 6 15:15:53 2021 -0600

Add test for [PR86650].

PR tree-optimization/86650 - -Warray-bounds missing inlining context

gcc/testsuite/ChangeLog:
PR tree-optimization/86650
* gcc.dg/Warray-bounds-76.c: New test.

[Bug tree-optimization/86650] -Warray-bounds missing inlining context

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

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |12.0
  Known to fail||11.1.0

--- Comment #8 from Martin Sebor  ---
Fixed by in GCC 12 via r12-1992 and r12-2087.

[Bug tree-optimization/56456] [meta-bug] bogus/missing -Warray-bounds

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

Bug 86650 Summary: -Warray-bounds missing inlining context
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86650

   What|Removed |Added

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

[Bug c/101352] New: ICE on valid code: in convert_move, at expr.c:279

2021-07-06 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101352

Bug ID: 101352
   Summary: ICE on valid code: in convert_move, at expr.c:279
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

Clang can compile the test program.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.t468jxVWYr-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210706 (experimental) [master revision
:e442981a9:a3543b5e8002c033b2304d7ac1d1e58218eebb51] (GCC)

$ cat mutant.c
void g(i) int i __attribute__((__vector_size__(16)));
{}

$ gcc-trunk  mutant.c
during RTL pass: expand
mutant.c: In function ‘g’:
mutant.c:1:6: internal compiler error: in convert_move, at expr.c:279
1 | void g(i) int i __attribute__((__vector_size__(16)));
  |  ^
0x6bf71f convert_move(rtx_def*, rtx_def*, int)
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/expr.c:279
0xb859a5 convert_modes(machine_mode, machine_mode, rtx_def*, int)
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/expr.c:738
0xbecea2 assign_parm_setup_stack
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/function.c:3470
0xbecea2 assign_parms
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/function.c:3701
0xbeea22 expand_function_start(tree_node*)
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/function.c:5155
0xa60fd5 execute
/tmp/tmp.t468jxVWYr-gcc-builder/gcc/gcc/cfgexpand.c:6693
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c++/101353] New: [x86-64] missed optimization: missed tail call in placement-new

2021-07-06 Thread arthur.j.odwyer at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101353

Bug ID: 101353
   Summary: [x86-64] missed optimization: missed tail call in
placement-new
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: arthur.j.odwyer at gmail dot com
  Target Milestone: ---

// https://godbolt.org/z/9zP5dP3sE
#include 
struct T {
int x;
T(int) noexcept;
~T();
};
T factory(int) noexcept;
alignas(T) char buffer[sizeof(T)];
void placement_new() {
::new ((void*)buffer) T(42);
}
void placement_call() {
::new ((void*)buffer) T(factory(42));
}

g++ -O2 -std=c++20 test.cpp

Somehow the compiler is failing to generate an actual `jmp` tail call for
`placement_call` the way it's able to for `placement_new`.

  _Z13placement_newv:
movl $42, %esi
movl $buffer, %edi
jmp _ZN1TC1Ei
  _Z14placement_callv:
subq $8, %rsp
movl $42, %esi
movl $buffer, %edi
call _Z7factoryi
addq $8, %rsp
ret

Note that right now Clang has the same symptom; but ICC and MSVC both get this
right and generate tail-calls appropriately in both cases. So this isn't any
obscure C++ corner case AFAICT; seems it's truly just a missed optimization.

Clang's missed-optimization bug is filed as
https://bugs.llvm.org/show_bug.cgi?id=51000

[Bug c++/55881] #pragma GCC diagnostic ignored ignored when inlining

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

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

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

commit r12-2092-ge8db5f70f27b6de8139339ef1866eaa153c2bf67
Author: Martin Sebor 
Date:   Tue Jul 6 15:58:02 2021 -0600

Add test for [PR55881].

PR c++/55881

gcc/testsuite/ChangeLog:

* g++.dg/warn/uninit-pr55881.C: New test.

[Bug c/101352] ICE on valid code: in convert_move, at expr.c:279

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

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
 Target||x86_64-pc-linux-gnu,
   ||aarch64-linux-gnu
Version|tree-ssa|12.0

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

pointer_to_this >
V4SI
size 
unit-size 
align:128 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xf59db7c0 nunits:4>
V4SI t5.c:1:15 size  unit-size 
align:128 warn_if_not_align:0 context 
arg-type 
incoming-rtl (reg:SI 0 x0 [ i ])>


Notice the incoming-rtl is in the wrong mode.

[Bug middle-end/55881] #pragma GCC diagnostic ignored ignored when inlining

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

Martin Sebor  changed:

   What|Removed |Added

  Known to fail||10.2.0, 11.1.0, 4.7.0,
   ||4.8.4, 4.9.4, 5.5.0, 6.4.0,
   ||7.2.0, 8.3.0, 9.1.0
 CC||msebor at gcc dot gnu.org
   Target Milestone|--- |12.0
 Status|NEW |RESOLVED
  Component|c++ |middle-end
 Resolution|--- |FIXED

--- Comment #10 from Martin Sebor  ---
Fixed for GCC 12 by r12-2087 and related.

[Bug tree-optimization/101353] [x86-64] missed optimization: missed tail call in placement-new

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

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Keywords||easyhack,
   ||missed-optimization
   Last reconfirmed||2021-07-06
 Status|UNCONFIRMED |NEW
Version|unknown |12.0
 Ever confirmed|0   |1
  Component|c++ |tree-optimization

--- Comment #1 from Andrew Pinski  ---
void placement_call ()
{
   [local count: 1073741824]:
  MEM[(struct T *)&buffer] = factory (42); [return slot optimization]
  return;

}

Most likely because the gimple level detection of tail calls does not handle
RSO based function calls with global data. It should not be hard to add.

[Bug inline-asm/101354] New: [11/12 regression] naked function mishandled - store optimized away

2021-07-06 Thread 2-gnu at 0x2c dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101354

Bug ID: 101354
   Summary: [11/12 regression] naked function mishandled - store
optimized away
   Product: gcc
   Version: 11.0
   URL: https://godbolt.org/z/4T4x8eb4f
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: inline-asm
  Assignee: unassigned at gcc dot gnu.org
  Reporter: 2-gnu at 0x2c dot org
  Target Milestone: ---

Stores are optimized away when a pointer is passed to a naked function.

Discovered in Nordic nRF5-SDK (17.0.2), which uses such a construct to
implement syscalls.

Minimal example:

__attribute__((naked))
 switching to O0 will make it work
//__attribute__((optimize("O0")))
static void extfun_ptr(int *a) {
__asm volatile("");
}

void fun() {
int v;
v = 1;
extfun_ptr(&v); // &v is never initialized
}

[Bug ipa/101354] [11/12 regression] naked function mishandled - store optimized away

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

Andrew Pinski  changed:

   What|Removed |Added

URL|https://godbolt.org/z/4T4x8 |
   |eb4f|
   Keywords||wrong-code
  Component|inline-asm  |ipa
 CC||marxin at gcc dot gnu.org

--- Comment #1 from Andrew Pinski  ---
https://godbolt.org/z/4T4x8eb4f

[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf

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

--- Comment #16 from CVS Commits  ---
The master branch has been updated by Indu Bhagat :

https://gcc.gnu.org/g:97bcacfb5ac49afa4e305489dd110cc446451549

commit r12-2093-g97bcacfb5ac49afa4e305489dd110cc446451549
Author: Indu Bhagat 
Date:   Tue Jul 6 16:02:38 2021 -0700

CTF testsuite: Remove explicit check on ctv_typeidx

The value of ctv_typeidx is the CTF type ID of the data type of the
associated
variable.  The order in which the CTF types are added can change across
platforms and also as the code evolves, hence changing the CTF type ID. As
there is no direct and portable method of testing that the data type of a
CTF
variable is of a specific kind, remove the check on ctv_typeidx.

This also fixes a subset of failures as seen on Darwin.

2021-07-06  Indu Bhagat  

gcc/testsuite/ChangeLog:

PR debug/101283
* gcc.dg/debug/ctf/ctf-attr-mode-1.c: Remove the check for
ctv_typeidx.

[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf

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

--- Comment #17 from CVS Commits  ---
The master branch has been updated by Indu Bhagat :

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

commit r12-2094-gd9e9532bb3bf5db4cd6afd49d343ede5b27c3c9f
Author: Indu Bhagat 
Date:   Tue Jul 6 16:11:47 2021 -0700

BTF testsuite: Remove explicit check on btm_type

The value of btm_type is the BTF type ID of the referred type.  The order
in
which the BTF types are added can change across platforms and also as the
code
evolves, hence changing the BTF type ID. As there is no direct and portable
method of testing that a BTF type refers to another BTF type of a specific
kind, remove the explicit check on btm_type.

This patch adjusts the testcase without affecting the test coverage as
other
testcases already have similar constructs. It also fixes a subset of
failures
as seen on Darwin.

2021-07-06  Indu Bhagat  

gcc/testsuite/ChangeLog:

PR debug/101283
* gcc.dg/debug/btf/btf-bitfields-3.c: Remove the check on btm_type.

[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf

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

--- Comment #18 from Indu Bhagat  ---
(In reply to Richard Biener from comment #4)
> It might make sense to provide targets a means to opt-out of CTF/BTF support
> and thus diagnose -gctf as unsupported on them.

Yes, I agree. It makes sense to have provide some means to opt out of CTF/BTF
support. I will look into this.

[Bug testsuite/101321] gcc.dg/debug/btf/btf-bitfields-3.c fail on arm-eabi

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

Indu Bhagat  changed:

   What|Removed |Added

 CC||ibhagatgnu at gmail dot com

--- Comment #5 from Indu Bhagat  ---
The issue here is in the testcase. It is relying on the order of the generated
CTF types.

Adding -fno-short-enums might have masked the issue, ideally the testcase
should be fixed by removing such a non-portable check.

I noticed similar issues on Darwin for PR debug/101283
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283

I think the following commit should have fixed this issue on arm-eabi as well.

The master branch has been updated by Indu Bhagat :

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

commit r12-2094-gd9e9532bb3bf5db4cd6afd49d343ede5b27c3c9f
Author: Indu Bhagat 
Date:   Tue Jul 6 16:11:47 2021 -0700

BTF testsuite: Remove explicit check on btm_type

The value of btm_type is the BTF type ID of the referred type.  The order in   
which the BTF types are added can change across platforms and also as the code
evolves, hence changing the BTF type ID. As there is no direct and portable
method of testing that a BTF type refers to another BTF type of a specific
kind, remove the explicit check on btm_type.

This patch adjusts the testcase without affecting the test coverage as other   
 testcases already have similar constructs. It also fixes a subset of failures 
 as seen on Darwin.

2021-07-06  Indu Bhagat  

gcc/testsuite/ChangeLog:

  PR debug/101283
  * gcc.dg/debug/btf/btf-bitfields-3.c: Remove the check on btm_type.

PS: I let -fno-short-enums remain in the testcase for now. If the patch fixes
the issue while removing -fno-short-enums, the testcase can be updated to not
have -fno-short-enums anymore.

[Bug tree-optimization/101250] adjust_iv_update_pos update the iv statement unexpectedly cause memory address offset mismatch

2021-07-06 Thread luoxhu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101250

--- Comment #1 from luoxhu at gcc dot gnu.org ---
Patch posted:

[PATCH] ivopts: Don't adjust IV update statement if both operands use the IV in
COND [PR101250]

https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573894.html

[Bug c++/101355] New: compiling coroutines with ubsan emits bogus -Wmaybe-uninitialized warnings

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

Bug ID: 101355
   Summary: compiling coroutines with ubsan emits bogus
-Wmaybe-uninitialized warnings
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: daklishch at gmail dot com
  Target Milestone: ---

Created attachment 5
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=5&action=edit
preprocessed source

Compiling the following program with UBSan emits -Wmaybe-uninitialized on
`' variables.
The compiler and runtime behavior is somewhat inconsistent. Normally, there is
only one warning per function and the program is not affected. However, for
example, compiling provided program with -O2 emits two identical warnings and
makes the program crash with `member call on null pointer of type 'struct a''.


$ cat testcode.cc
#include 

struct coro {
struct promise_type {
coro get_return_object() { return {}; }
std::suspend_never initial_suspend() noexcept { return {}; }
std::suspend_never final_suspend() noexcept { return {}; }
void unhandled_exception() {}
void return_void() {}
};

bool await_ready() { return true; }
void await_resume() {}
template 
void await_suspend(U &) {}
};

struct b {
~b() {}
};

struct a {
a(b) {}
~a() {}
};

coro f(b obj) {
auto obj2 = a{obj};
co_return;
}

int main() {
f({});
}
$ ~/gcc-dev/bin/gccdev -O2 -std=c++20 -Wall -fsanitize=undefined testcode.cc
-lstdc++
testcode.cc: In function ‘void _Z1f1b.actor(f(b)::_Z1f1b.frame*)’:
testcode.cc:30:1: warning: ‘’ may be used uninitialized
[-Wmaybe-uninitialized]
   30 | }
  | ^
testcode.cc:30:1: note: ‘’ was declared here
   30 | }
  | ^
In function ‘void _Z1f1b.actor(f(b)::_Z1f1b.frame*)’,
inlined from ‘coro f(b)’ at testcode.cc:27:6:
testcode.cc:30:1: warning: ‘’ is used uninitialized
[-Wuninitialized]
   30 | }
  | ^
testcode.cc: In function ‘coro f(b)’:
testcode.cc:30:1: note: ‘’ was declared here
   30 | }
  | ^
$ ./a.out
testcode.cc:30:1: runtime error: member call on null pointer of type 'struct a'

[Bug c++/101355] compiling coroutines with ubsan emits bogus -Wmaybe-uninitialized warnings

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

--- Comment #1 from Dan Klishch  ---
Created attachment 51112
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51112&action=edit
gcc with -v option output

[Bug c++/101356] New: The non-public member of a local class cannot be accessed by a friend of the class

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

Bug ID: 101356
   Summary: The non-public member of a local class cannot be
accessed by a friend of the class
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: xmh970252187 at gmail dot com
  Target Milestone: ---


auto fun(){
void show();
struct C{
friend void show();
private:
  int c;
};
return C{};
}
void show(){
   auto o = fun();
   o.c = 0;
}

Clang accepts this example while GCC rejects it by reporting an error
diagnosis. 

As per [class.friend#1]

> A friend of a class is a function or class that is given permission to name 
> the >private and protected members of the class. A class specifies its 
> friends, if >any, by way of friend declarations. Such declarations give 
> special access rights >to the friends, but they do not make the nominated 
> friends members of the >befriending class.

[Bug rtl-optimization/100328] IRA doesn't model matching constraint well

2021-07-06 Thread linkw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100328

Kewen Lin  changed:

   What|Removed |Added

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

--- Comment #11 from Kewen Lin  ---
Should be resolved on trunk.

[Bug gcov-profile/101357] New: the coverage of a return statement goes wrong

2021-07-06 Thread byone.heng at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101357

Bug ID: 101357
   Summary: the coverage of a return statement goes wrong
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: gcov-profile
  Assignee: unassigned at gcc dot gnu.org
  Reporter: byone.heng at gmail dot com
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

$./gcc -v   
Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/home/x/project/gcc/build/install/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/x/project/gcc/build/install
--enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20210105 (experimental) (GCC)

$cat test.c
const int true_var = 1;
static const unsigned long int false_var = 0;
extern void abort (void);
typedef int __attribute__((vector_size (32))) m256i;
__attribute__((noinline, noclone)) void
foo (int *x, m256i *y)
{
  asm volatile ("" : : "r" (x), "r" (y) : "memory");
}
__attribute__((noinline, noclone)) int
bar (int x)
{
  if (x > 20)
return 24;
  m256i i;
  foo (__builtin_alloca (x), &i);
  return 128;
}
__attribute__((noinline, noclone)) int
baz (int d0, int d1, int d2, int d3, int d4, int d5, int x)
{
  if (x > 20)
return 24;
  m256i i;
  d0 += d1 + d2 + d3 + d4 + d5; d1 += d0;
  foo (__builtin_alloca (x), &i);
  if( true_var > 0 )
  {
  return 128;
  }
}
int
main ()
{
  if (bar (22) != 24 || bar (20) != 128)
abort ();
#ifdef __x86_64__
  register long long r10 __asm__ ("r10") = 0xdeadbeefdeadbeefULL;
  asm volatile ("" : "+r" (r10));
#endif
  if (baz (0, 0, 0, 0, 0, 0, 22) != 24 || baz (0, 0, 0, 0, 0, 0, 20) != 128)
abort ();
  return 0;
}


$gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov

-:5:const int true_var = 1;
-:6:static const unsigned long int false_var = 0;
-:7:
-:8:extern void abort (void);
-:9:
-:   10:typedef int __attribute__((vector_size (32))) m256i;
-:   11:
-:   12:__attribute__((noinline, noclone)) void
2:   13:foo (int *x, m256i *y)
-:   14:{
2:   15:  asm volatile ("" : : "r" (x), "r" (y) : "memory");
2:   16:}
-:   17:
-:   18:__attribute__((noinline, noclone)) int
2:   19:bar (int x)
-:   20:{
2:   21:  if (x > 20)
1:   22:return 24;
-:   23:  m256i i;
1:   24:  foo (__builtin_alloca (x), &i);
1:   25:  return 128;
-:   26:}
-:   27:
-:   28:__attribute__((noinline, noclone)) int
2:   29:baz (int d0, int d1, int d2, int d3, int d4, int d5, int x)
-:   30:{
2:   31:  if (x > 20)
2:   32:return 24;
-:   33:  m256i i;
1:   34:  d0 += d1 + d2 + d3 + d4 + d5; d1 += d0;
1:   35:  foo (__builtin_alloca (x), &i);
1:   36:  if( true_var > 0 )
-:   37:  {
1:   38:  return 128;
-:   39:  }
#:   40:}
-:   41:
-:   42:int
1:   43:main ()
-:   44:{
1:   45:  if (bar (22) != 24 || bar (20) != 128)
#:   46:abort ();
-:   47:#ifdef __x86_64__
1:   48:  register long long r10 __asm__ ("r10") =
0xdeadbeefdeadbeefULL;
1:   49:  asm volatile ("" : "+r" (r10));
-:   50:#endif
1:   51:  if (baz (0, 0, 0, 0, 0, 0, 22) != 24 || baz (0, 0, 0, 0, 0,
0, 20) != 128)
#:   52:abort ();
1:   53:  return 0;
-:   54:}

Line 32 should be executed one time.

[Bug c/101358] New: Warn when saving a pointer to an object with temporary lifetime

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

Bug ID: 101358
   Summary: Warn when saving a pointer to an object with temporary
lifetime
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: diagnostic
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: josephcsible at gmail dot com
  Target Milestone: ---

Consider this C code:

typedef struct {
int x[1];
} foo;

foo f(void);

int g(void) {
int *p = f().x;
return *p;
}

The g() function is always UB, since the return value of f() has temporary
lifetime, so doing "return *p;" is dereferencing a pointer to an object whose
lifetime has ended. (This is the case both before and after C11's change to
temporary lifetime.) Since it's obvious at compile time that p can never be
used safely, we should have a warning for it, similar to how we have
-Wreturn-local-addr to catch mistakes like this function:

int *h(void) {
int x;
return &x;
}

[Bug gcov-profile/101359] New: wrong coverage for a compound statement

2021-07-06 Thread byone.heng at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101359

Bug ID: 101359
   Summary: wrong coverage for a compound statement
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: gcov-profile
  Assignee: unassigned at gcc dot gnu.org
  Reporter: byone.heng at gmail dot com
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

$./gcc -v   
Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/home/x/project/gcc/build/install/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/x/project/gcc/build/install
--enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20210105 (experimental) (GCC)

$cat test.c
const unsigned int true_var = 1;
static const short int false_var = 0;
typedef double v2df __attribute__((vector_size (16)));
static v2df __attribute__((noinline))
bar (v2df a)
{
  return a + (v2df){ 3.0, 3.0 };
}

v2df __attribute__((noinline))
foo (v2df y)
{
  return y + bar (y);
}
int
main (void)
{
  int success;
  union {
v2df v;
double d[2];
  } u;
  u.v = foo ((v2df){ 5.0, 5.0});
  success = (u.d[0] == 13.0
 && u.d[1] == 13.0);
  return !success;
}



$gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov

   -:4:const unsigned int true_var = 1;
-:5:static const short int false_var = 0;
-:6:
-:7:typedef double v2df __attribute__((vector_size (16)));
-:8:
-:9:static v2df __attribute__((noinline))
1:   10:bar (v2df a)
-:   11:{
1:   12:  return a + (v2df){ 3.0, 3.0 };
-:   13:}
-:   14:
-:   15:v2df __attribute__((noinline))
1:   16:foo (v2df y)
-:   17:{
1:   18:  return y + bar (y);
-:   19:}
-:   20:
-:   21:int
1:   22:main (void)
-:   23:{
-:   24:  int success;
-:   25:  union {
-:   26:v2df v;
-:   27:double d[2];
-:   28:  } u;
-:   29:
1:   30:  u.v = foo ((v2df){ 5.0, 5.0});
2:   31:  success = (u.d[0] == 13.0
   1*:   32: && u.d[1] == 13.0);
-:   33:
1:   34:  return !success;
-:   35:}

Line 31 should be executed one time.

[Bug gcov-profile/101360] New: [Gcov] the assignment statement is marked as executed twice while the similar statement has executed one time

2021-07-06 Thread byone.heng at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101360

Bug ID: 101360
   Summary: [Gcov] the assignment statement is marked as executed
twice while the similar statement has executed one
time
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: gcov-profile
  Assignee: unassigned at gcc dot gnu.org
  Reporter: byone.heng at gmail dot com
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

$./gcc -v   
Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/home/x/project/gcc/build/install/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/x/project/gcc/build/install
--enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20210105 (experimental) (GCC)

$cat test.c
const short int true_var = 1;
static signed char false_var = 0;
extern inline __attribute__ ((__always_inline__, __gnu_inline__)) char *
strstr (const char *haystack, const char *needle)
{
  return __builtin_strstr (haystack, needle);
}
int
main (int argc, const char **argv)
{
  if( true_var > 0 )
  {
  char *substr = strstr (argv[0], "\n");
  char *another = strstr (argv[0], "\r\n");
  }
  return 0;
}

$gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov

-:5:const short int true_var = 1;
-:6:static signed char false_var = 0;
-:7:
-:8:extern inline __attribute__ ((__always_inline__,
__gnu_inline__)) char *
-:9:strstr (const char *haystack, const char *needle)
-:   10:{
2:   11:  return __builtin_strstr (haystack, needle);
-:   12:}
-:   13:
-:   14:int
1:   15:main (int argc, const char **argv)
-:   16:{
1:   17:  if( true_var > 0 )
-:   18:  {
1:   19:  char *substr = strstr (argv[0], "\n");
2:   20:  char *another = strstr (argv[0], "\r\n");
-:   21:  }
1:   22:  return 0;
-:   23:}

Line 20 should be executed one time.

[Bug c++/101361] New: Bogus -Wstringop-overread warning with -O3

2021-07-06 Thread boris at kolpackov dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101361

Bug ID: 101361
   Summary: Bogus -Wstringop-overread warning with -O3
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: boris at kolpackov dot net
  Target Milestone: ---

Created attachment 51113
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51113&action=edit
reproducer

g++ -Wall -Wextra -O3 -std=c++2a -o driver.o -c -fdirectives-only driver.ii

In file included from
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/string:40,
 from
/home/boris/work/build2/libbutl/tests/prefix-map/driver.cxx:7:
In static member function ‘static constexpr int
std::char_traits::compare(const char_type*, const char_type*,
std::size_t)’,
inlined from ‘int butl::compare_prefix
>::compare(const C*, butl::compare_prefix
>::size_type, const C*, butl::compare_prefix
>::size_type) const [with C = char]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:93:35,
inlined from ‘bool butl::compare_prefix
>::prefix(const K&, const K&) const [with C = char]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:70:18,
inlined from ‘std::pair butl::prefix_map_common::find_sub(const key_type&) const
[with M = std::map, int,
butl::compare_prefix >,
std::allocator, int> > >]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.txx:36:21:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/char_traits.h:361:32:
warning: ‘int __builtin_memcmp_eq(const void*, const void*, long unsigned int)’
specified bound 18446744073709551615 exceeds maximum object size
9223372036854775807 [-Wstringop-overread]
  361 | return __builtin_memcmp(__s1, __s2, __n);
  |^
In file included from
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/string:55,
 from
/home/boris/work/build2/libbutl/tests/prefix-map/driver.cxx:7:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/basic_string.h:
In member function ‘std::pair butl::prefix_map_common::find_sub(const key_type&) const
[with M = std::map, int,
butl::compare_prefix >,
std::allocator, int> > >]’:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/basic_string.h:187:28:
note: source object allocated here
  187 |   { return _M_dataplus._M_p; }
  |^~~~
In file included from
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/string:40,
 from
/home/boris/work/build2/libbutl/tests/prefix-map/driver.cxx:7:
In static member function ‘static constexpr int
std::char_traits::compare(const char_type*, const char_type*,
std::size_t)’,
inlined from ‘int butl::compare_prefix
>::compare(const C*, butl::compare_prefix
>::size_type, const C*, butl::compare_prefix
>::size_type) const [with C = char]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:93:35,
inlined from ‘bool butl::compare_prefix
>::prefix(const K&, const K&) const [with C = char]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:70:18,
inlined from ‘std::pair
butl::prefix_map_common::find_sub(const key_type&) [with M =
std::map, int,
butl::compare_prefix >,
std::allocator, int> > >]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.txx:17:21:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/char_traits.h:361:32:
warning: ‘int __builtin_memcmp_eq(const void*, const void*, long unsigned int)’
specified bound 18446744073709551615 exceeds maximum object size
9223372036854775807 [-Wstringop-overread]
  361 | return __builtin_memcmp(__s1, __s2, __n);
  |^
In file included from
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/string:55,
 from
/home/boris/work/build2/libbutl/tests/prefix-map/driver.cxx:7:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/basic_string.h:
In member function ‘std::pair
butl::prefix_map_common::find_sub(const key_type&) [with M =
std::map, int,
butl::compare_prefix >,
std::allocator, int> > >]’:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/basic_string.h:187:28:
note: source object allocated here
  187 |   { return _M_dataplus._M_p; }
  |^~~~

[Bug c++/101343] ICE in tsubst_copy, at cp/pt.c:15732

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101343

Richard Biener  changed:

   What|Removed |Added

  Known to work||11.1.1, 12.0
 Status|UNCONFIRMED |NEW
  Known to fail||10.3.1, 9.4.1
 Ever confirmed|0   |1
   Last reconfirmed||2021-07-07
   Keywords||ice-on-valid-code,
   ||needs-bisection,
   ||needs-reduction

--- Comment #1 from Richard Biener  ---
Confirmed on the GCC 9 and 10 branch heads, seems to work with GCC 11 and
trunk.

[Bug rtl-optimization/101347] [11/12 Regression] ICE in cfg_layout_initialize with __builtin_setjmp and -fprofile-generate -fprofile-use

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101347

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #1 from Richard Biener  ---
Confirmed.

Program received signal SIGSEGV, Segmentation fault.
0x00cc2c66 in cfg_layout_initialize (flags=0)
at /home/rguenther/src/gcc2/gcc/cfgrtl.c:4478
4478  bb->flags |= BB_NON_LOCAL_GOTO_TARGET;
(gdb) l
4473
4474  /* Make sure that the targets of non local gotos are marked.  */
4475  for (x = nonlocal_goto_handler_labels; x; x = x->next ())
4476{
4477  bb = BLOCK_FOR_INSN (x->insn ());
4478  bb->flags |= BB_NON_LOCAL_GOTO_TARGET;
4479}

and bb is NULL.  We have

(note/s 38 0 0 "" NOTE_INSN_DELETED_LABEL 3)

as x->insn (), so whatever deleted this label forgot to adjust
nonlocal_goto_handler_labels (or wrongly deleted it).

Breakpoint 5, delete_insn (insn=0x76557780)
at /home/rguenther/src/gcc2/gcc/cfgrtl.c:138
138   bool really_delete = true;
(gdb) p debug_rtx (insn)
(code_label/s 38 37 53 5 3 (nil) [3 uses])
(gdb) bt
#0  delete_insn (insn=0x76557780)
at /home/rguenther/src/gcc2/gcc/cfgrtl.c:138
#1  0x00cb8d09 in delete_insn_chain (start=0x76557780, 
finish=0x76557e00, clear_bb=true)
at /home/rguenther/src/gcc2/gcc/cfgrtl.c:273
#2  0x00cb913f in rtl_delete_block (b=)
at /home/rguenther/src/gcc2/gcc/cfgrtl.c:420
#3  0x00ca542a in delete_basic_block (
bb=)
at /home/rguenther/src/gcc2/gcc/cfghooks.c:603
#4  0x0229b84b in delete_unreachable_blocks ()
at /home/rguenther/src/gcc2/gcc/cfgcleanup.c:3058
#5  0x0229ba3c in cleanup_cfg (mode=16)
at /home/rguenther/src/gcc2/gcc/cfgcleanup.c:3122
#6  0x00c9cc0f in (anonymous namespace)::pass_expand::execute (
this=0x38446a0, fun=0x7669f000)
at /home/rguenther/src/gcc2/gcc/cfgexpand.c:6974
#7  0x012275f7 in execute_one_pass (
pass=)
at /home/rguenther/src/gcc2/gcc/passes.c:2567

I don't know how nonlocal_goto_handler_labels is supposed to work.

[Bug rtl-optimization/101347] [11/12 Regression] ICE in cfg_layout_initialize with __builtin_setjmp and -fprofile-generate -fprofile-use

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101347

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug target/101351] ICE on valid code with -O1: in lra_split_hard_reg_for, at lra-assigns.c:1837

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101351

Richard Biener  changed:

   What|Removed |Added

 Target||x86_64-*-*

--- Comment #1 from Richard Biener  ---
I think this is invalid code but hard to diagnose (_Complex long doesn't fit
"rax", not sure if we're supposed to allocate a register pair here magically).

[Bug c/101352] ICE on valid code: in convert_move, at expr.c:279

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101352

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #2 from Richard Biener  ---
because DECL_ARG_TYPE is

  arg-type 

I don't think __attribute__((vector_size)) works well outside of typedefs ...

OTOH maybe it's a K&R style arg parsing issue.

[Bug ipa/101354] [11/12 regression] naked function mishandled - store optimized away

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101354

Richard Biener  changed:

   What|Removed |Added

 Target||x86_64-*-*
 Ever confirmed|0   |1
   Last reconfirmed||2021-07-07
   Target Milestone|--- |11.2
 Status|UNCONFIRMED |NEW
 CC||hubicka at gcc dot gnu.org

--- Comment #2 from Richard Biener  ---
Likely modref, but then IPA eventually generally mishandles "naked" functions. 
Note that "naked" is a target attribute so what we likely need is a target hook
computing extra "body" flags?

Or are traditional asm allowed to access & modify auto variables and
parameters?  I think only for "naked" functions such access is reliably
possible.

Not sure if there's a way for IPA to query for target attributes that have
effects on IPA semantics.

[Bug ipa/101354] [11/12 regression] naked function mishandled - store optimized away

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101354

--- Comment #3 from Richard Biener  ---
OTOH decl-attributes.c has generic code doing

  /* A "naked" function attribute implies "noinline" and "noclone" for
 those targets that support it.  */
  if (TREE_CODE (*node) == FUNCTION_DECL
  && attributes
  && lookup_attribute ("naked", attributes) != NULL
  && lookup_attribute_spec (get_identifier ("naked")))
{
  if (lookup_attribute ("noinline", attributes) == NULL)
attributes = tree_cons (get_identifier ("noinline"), NULL, attributes);

  if (lookup_attribute ("noclone", attributes) == NULL)
attributes = tree_cons (get_identifier ("noclone"),  NULL, attributes);
}

maybe we should simply add "noipa" and eventually also "used" to it ... (if
that's enough)