[Bug target/11877] gcc should use xor trick with -Os

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||jeffreyalaw at gmail dot com

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

[Bug target/41505] GCC choosing poor code sequence for certain stores (x86)

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #8 from Andrew Pinski  ---
This is a dup of bug 11877 which is now fixed on the trunk.

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

[Bug tree-optimization/50286] Missed optimization, fails to propagate bool

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2011-12-14 00:00:00 |2021-7-26

--- Comment #2 from Andrew Pinski  ---
EVRP is able to convert the loop to:
   :
  # i_3 = PHI <0(2), 1(3)>
  _2 = i_3 * i_3;
  printf ("%d\n", _2);
  i_10 = i_3 == 0 ? 1 : 2;
  if (flag_6 >= i_10)
goto ; [INV]
  else
goto ; [INV]

flag_6 range is [0,1] even

[Bug fortran/101632] New: NON_RECURSIVE procedure prefix is unsupported. F2018 defaults to recursive procedures.

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

Bug ID: 101632
   Summary: NON_RECURSIVE procedure prefix is unsupported.  F2018
defaults to recursive procedures.
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: kargl at gcc dot gnu.org
  Target Milestone: ---

[Bug c++/101629] New: ICE: in cp_finish_decl, at cp/decl.c:7826

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

Bug ID: 101629
   Summary: ICE: in cp_finish_decl, at cp/decl.c:7826
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

auto f(auto... args) {
  if constexpr (auto x = [args]{});
}

int main() {
  f(0, 0.4);
}

https://godbolt.org/z/WWr9hsWqh

[Bug tree-optimization/78888] toupper(x) can be assumed not to be in the range 'a' - 'z'

2021-07-26 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7

Andrew Macleod  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED
 CC||amacleod at redhat dot com

--- Comment #3 from Andrew Macleod  ---
fixed

[Bug c/101630] New: ICE with -Wall: in get_constant, at c-family/c-format.c:325

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

Bug ID: 101630
   Summary: ICE with -Wall: in get_constant, at
c-family/c-format.c:325
   Product: gcc
   Version: 12.0
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.Tt2AkDfoq0-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 20210726 (experimental) [master revision
:c09cf6429:124bb55777c280a85d0c72ec13e293a32917a6b9] (GCC)

$ cat mutant.c
printf(char[][], ...) { printf(printf); }

$ gcc-trunk -Wall mutant.c
mutant.c:1:12: error: array type has incomplete element type ‘char[]’
1 | printf(char[][], ...) { printf(printf); }
  |^
mutant.c:1:12: note: declaration of multidimensional array must have bounds for
all dimensions except the first
mutant.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
1 | printf(char[][], ...) { printf(printf); }
  | ^~
mutant.c: In function ‘printf’:
mutant.c:1:32: error: type of formal parameter 1 is incomplete
1 | printf(char[][], ...) { printf(printf); }
  |^~
mutant.c:1:1: internal compiler error: in get_constant, at
c-family/c-format.c:325
1 | printf(char[][], ...) { printf(printf); }
  | ^~
0x675c97 get_constant
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c-family/c-format.c:325
0x675c97 get_constant
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c-family/c-format.c:313
0x9b061e decode_format_attr
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c-family/c-format.c:377
0x9b2894 check_function_format(tree_node const*, tree_node*, int, tree_node**,
vec*)
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c-family/c-format.c:1173
0x9a1c86 check_function_arguments(unsigned int, tree_node const*, tree_node
const*, int, tree_node**, vec*)
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c-family/c-common.c:5981
0x92a0eb build_function_call_vec(unsigned int, vec, tree_node*, vec*, vec*, tree_node*)
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-typeck.c:3195
0x94b27a c_parser_postfix_expression_after_primary
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:10505
0x93bc65 c_parser_postfix_expression
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:10178
0x946141 c_parser_unary_expression
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:8224
0x94780f c_parser_cast_expression
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:8066
0x947abf c_parser_binary_expression
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:7869
0x948da8 c_parser_conditional_expression
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:7592
0x949420 c_parser_expr_no_commas
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:7507
0x9496b1 c_parser_expression
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:10641
0x949e87 c_parser_expression_conv
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:10680
0x95d2f3 c_parser_statement_after_labels
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:6249
0x95f594 c_parser_compound_statement_nostart
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:5788
0x95fc84 c_parser_compound_statement
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:5597
0x961672 c_parser_declaration_or_fndef
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:2539
0x968ff3 c_parser_external_declaration
/tmp/tmp.Tt2AkDfoq0-gcc-builder/gcc/gcc/c/c-parser.c:1777
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.





Note that with -Wall, gcc-trunk also crashes though with a different stack
trace.

mutant.c:1:12: error: array type has incomplete element type ‘char[]’
1 | printf(char[][], ...) { printf(printf); }
  |^
mutant.c:1:12: note: declaration of multidimensional array must have bounds for
all dimensions except the first
mutant.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
1 | printf(char[][], ...) { printf(printf); }
  | ^~
mutant.c: In function ‘printf’:
mutant.c:1:32: error: type of formal parameter 1 is incomplete
1 | printf(char[][], ...) { printf(printf); }
  |^~
mutant.c:1:25: internal compiler error: tree check: expected class ‘type’

[Bug target/26656] Optimization flaw on conditional set of a bit.

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

Andrew Pinski  changed:

   What|Removed |Added

  Component|tree-optimization   |target
 Target||x86_64

--- Comment #9 from Andrew Pinski  ---
flagQuestion:
.L2:
cmpb%bpl, (%r12,%rax)
setb%cl
addl%ecx, %ecx
orb %cl, (%rbx,%rax)
addq$1, %rax
cmpq$1, %rax
jne .L2
flagQuestionWorkaround:
.L7:
cmpb%bpl, (%r12,%rax)
setb%cl
addl%ecx, %ecx
orb %cl, (%rbx,%rax)
addq$1, %rax
cmpq$1, %rax
jne .L7
flagIf:
.L12:
cmpb%bl, (%r12,%rax)
jnb .L11
orb $2, 0(%rbp,%rax)
.L11:
addq$1, %rax
cmpq$1, %rax
jne .L12
flagIfWorkaround:
.L16:
cmpb%bpl, (%r12,%rax)
setb%cl
addl%ecx, %ecx
orb %cl, (%rbx,%rax)
addq$1, %rax
cmpq$1, %rax
jne .L16

There is not much be done with flagIf really since it is a conditional
load/store.

[Bug target/49127] -Os generates constant mov instead of instruction xor and mov when zeroing

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
This is a dup of bug 11877 and is fixed on the trunk.

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

[Bug fortran/101632] NON_RECURSIVE procedure prefix is unsupported. F2018 defaults to recursive procedures.

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

--- Comment #1 from kargl at gcc dot gnu.org ---
F2018 introduced the NON_RECURSIVE prefix for procedures and also made
procedures recursive by default.  This code is conforming to F2018.

module bah

   contains
  !
  ! non_recursive is F2018.
  !
  non_recursive function foo(i) result(k)
 integer k
 integer, intent(in) :: i
 k = i
  end function foo
  !
  ! Recursive has been around for awhile, and still in F2018
  !
  recursive function fib1(i) result(k)
 integer k
 integer, intent(in) :: i
 if (i <= 1) then
k = i
 else
k = fib1(i-1) + fib1(i - 2)
 end if
  end function fib1
  !
  ! This is recursive by default.
  !
  function fib2(i) result(k)
 integer k
 integer, intent(in) :: i
 if (i <= 1) then
k = i
 else
k = fib2(i-1) + fib2(i - 2)
 end if
  end function fib2

end module bah

program bar
   use bah
   integer i
   i = 9
   print *, fib1(i), fib2(i)
end program bar

[Bug fortran/101632] NON_RECURSIVE procedure prefix is unsupported. F2018 defaults to recursive procedures.

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

--- Comment #2 from kargl at gcc dot gnu.org ---
Created attachment 51207
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51207=edit
Diff that implements F2018 NON_RECURSIVE and makes things recursive by default.

[Bug tree-optimization/24696] missing optimization in comparison of results of bit operations

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---

>From ifcombine:
optimizing bits or bits test to _3 & T != 0
with temporary T = b_6(D) | a_4(D)
Merging blocks 2 and 3

Fixed by r0-128808.

[Bug tree-optimization/68136] missed tree-level optimization with redundant computations

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2015-10-28 00:00:00 |2021-7-26

--- Comment #3 from Andrew Pinski  ---
Improved for GCC 11 by r11-3207 . The testcase even was changed to show that it
is not fully fixed:

typedef long long s64;
int
foo (s64 a, s64 b, s64 c)
{
 s64 d = a - b;

  if (d == 0)
return a + c;
  else
return b + c + d;
}

[Bug tree-optimization/78888] toupper(x) can be assumed not to be in the range 'a' - 'z'

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

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Andrew Macleod :

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

commit r12-2519-gd5a8c1382718ae084d46ff9b8a26d6b1d0cb684c
Author: Andrew MacLeod 
Date:   Mon Jul 26 17:25:06 2021 -0400

Confirm and Handle only ASCII in toupper and tolower ranges.

PR tree-optimization/7
* gimple-range-fold.cc (get_letter_range): New.
(fold_using_range::range_of_builtin_call): Call get_letter_range.

[Bug rtl-optimization/70782] zero-initialized long returned by value generates useless stores/loads to the stack

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
Confirmed.  Note the non-union case started to work with GCC 11.

[Bug target/67510] x86: Faster code is possible for integer absolute value

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

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=97873,
   ||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=92651
   Target Milestone|--- |11.0
 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #2 from Andrew Pinski  ---
Fixed by r10-5498 and r11-5429 .

[Bug tree-optimization/71461] missed optimization in conditional assignment

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2016-06-09 00:00:00 |2021-7-26
   Severity|normal  |enhancement

[Bug middle-end/19466] [meta-bug] bit-fields are non optimal

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
Mine but I suspect this won't be until next year.

[Bug tree-optimization/24568] [meta-bug] Missed optimization: trivialization of silly code

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2008-11-22 10:41:24 |2021-7-26

--- Comment #10 from Andrew Pinski  ---
Hmm,
 For ILP32 the only thing we have left is:
  milliDiff_6 = -milliDiff_5(D);
  minutesDiff_13 = milliDiff_6 / 6;
  minutesDiff_8 = -minutesDiff_13;

For LP64:
  milliDiff_8 = -milliDiff_7(D);
  _3 = milliDiff_8 / 1000;
  _12 = (int) _3;
  minutesDiff_13 = _12 / 60;
  minutesDiff_10 = -minutesDiff_13;
...
  _17 = milliDiff_7(D) / 1000;
  _5 = (int) _17;
  minutesDiff_16 = _5 / 60;

[Bug target/66663] gcc misses optimization emits useless test of (a & 31) with 32

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
GCC 9+ is able to produce:
foo(unsigned long long, int):
.LFB0:
.cfi_startproc
movl4(%esp), %eax
movl12(%esp), %ecx
movl8(%esp), %edx
shldl   %eax, %edx
sall%cl, %eax
ret

[Bug target/84431] Suboptimal code for masked shifts (x86/x86-64)

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||fuz at fuz dot su

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

[Bug target/66663] gcc misses optimization emits useless test of (a & 31) with 32

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

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|FIXED   |DUPLICATE

--- Comment #3 from Andrew Pinski  ---
It was fixed by r9-62 which means this is a dup of bug 84431.

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

[Bug tree-optimization/101626] [12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2376

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

Andrew Pinski  changed:

   What|Removed |Added

  Component|c   |tree-optimization
 CC||pinskia at gcc dot gnu.org
   Target Milestone|--- |12.0

[Bug c++/55436] g++ compiles invalid code with child class of nested class in template class

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

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED
   Target Milestone|--- |7.0
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=10200,
   ||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=69753

--- Comment #12 from Andrew Pinski  ---
Fixed in GCC 7 by r7-755.

[Bug c++/51716] access to private member possible

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

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |5.0
 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED

--- Comment #3 from Andrew Pinski  ---
Dup of bug 24926.

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

[Bug c++/24926] gcc ignores access level violation for anonymous structs

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||kuba at et dot pl

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

[Bug c++/52618] Explicit template specialization ignores access rights

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
Fixed in GCC 4.8+.

[Bug c++/52761] [C++11] Missing diagnostic for opaque unscoped enum declaration without base

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

--- Comment #2 from Andrew Pinski  ---
clang declared this as a GNU extention :)
:2:6: error: redeclaration of already-defined enum 'E' is a GNU
extension [-Werror,-Wgnu-redeclared-enum]
enum E;  // illegal
 ^
:1:6: note: previous definition is here
enum E { X };
 ^

<    1   2