[Bug c++/101603] [meta-bug] pointer to member functions issues

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101603
Bug 101603 depends on bug 90780, which changed state.

Bug 90780 Summary: references to pmf types mess up
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90780

   What|Removed |Added

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

[Bug c++/70097] Cannot assign ref-qualified non-static member function

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70097

Andrew Pinski  changed:

   What|Removed |Added

 CC||language.lawyer at gmail dot 
com

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

[Bug c++/90780] references to pmf types mess up

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90780

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
This is a dup of bug 70097.

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

[Bug c++/90780] references to pmf types mess up

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90780

Andrew Pinski  changed:

   What|Removed |Added

Summary|GCC loses ref-qualifiers|references to pmf types
   ||mess up
 Blocks||101603

--- Comment #2 from Andrew Pinski  ---
Reduced testcase:
using abominable = void() &;
struct s {
abominable f;
};
abominable s::* ptr = ::f;


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101603
[Bug 101603] [meta-bug] pointer to member functions issues

[Bug c++/67491] [meta-bug] concepts issues

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
Bug 67491 depends on bug 78802, which changed state.

Bug 78802 Summary: ICE with auto placeholder concept in 
synthesize_implicit_template_parm
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78802

   What|Removed |Added

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

[Bug c++/82768] ICE in synthesize_implicit_template_parm, at cp/parser.c:39338

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82768

Andrew Pinski  changed:

   What|Removed |Added

 CC||pkeir at outlook dot com

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

[Bug c++/78802] ICE with auto placeholder concept in synthesize_implicit_template_parm

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78802

Andrew Pinski  changed:

   What|Removed |Added

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

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

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

[Bug c++/89642] gcc rejects valid implicit typename context in cast

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89642

--- Comment #3 from Andrew Pinski  ---
GCC, ICC, clang and MSVC all reject this at -std=c++20 (or /std:c++latest for
MSVC).

[Bug c++/68138] "operator== is ambiguous" when comparing a tuple containing values with one containing refs

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68138

--- Comment #4 from Andrew Pinski  ---
The original testcase and the one in comment #2 started to work in GCC 11+.

[Bug c++/87327] [8 Regression] Calling member functions on captured constexpr variables "is not a constant expression"

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87327

Andrew Pinski  changed:

   What|Removed |Added

 CC||rcc.dark at gmail dot com

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

[Bug c++/89643] [8 Regression] constexpr capture not working inside expression

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89643

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
This was a regression in 8.1.0-8.3.0 and was fixed for 8.4.0.  This is a dup of
bug 87327.

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

[Bug c++/67491] [meta-bug] concepts issues

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
Bug 67491 depends on bug 82768, which changed state.

Bug 82768 Summary: ICE in synthesize_implicit_template_parm, at 
cp/parser.c:39338
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82768

   What|Removed |Added

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

[Bug c++/71543] [concepts] ICE on ill-formed declaration of a parameter with a constrained-type-specifier in a requires expression

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71543

Andrew Pinski  changed:

   What|Removed |Added

 CC||gomboc at cs dot ucr.edu

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

[Bug c++/82768] ICE in synthesize_implicit_template_parm, at cp/parser.c:39338

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82768

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #4 from Andrew Pinski  ---
Dup of bug 71543.

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

[Bug c++/67491] [meta-bug] concepts issues

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
Bug 67491 depends on bug 78511, which changed state.

Bug 78511 Summary: ICE on using concept name as a "requires" parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78511

   What|Removed |Added

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

[Bug c++/71543] [concepts] ICE on ill-formed declaration of a parameter with a constrained-type-specifier in a requires expression

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71543

Andrew Pinski  changed:

   What|Removed |Added

 CC||gcc-bugzilla at minijackson 
dot 33
   ||mail.com

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

[Bug c++/78511] ICE on using concept name as a "requires" parameter

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78511

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
Dup so closing as such.

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

[Bug c++/89085] call of overload is ambiguous with parameter packs

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89085

Andrew Pinski  changed:

   What|Removed |Added

  Known to work||10.2.0, 10.3.0, 11.1.0,
   ||11.2.0
  Known to fail||10.1.0, 9.4.0

--- Comment #1 from Andrew Pinski  ---
Seems fixed in GCC 10.3 and GCC 11+.

[Bug c++/88694] constexpr isn't captured correctly in lambda

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88694

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||10.3.0
  Known to work||11.1.0

--- Comment #5 from Andrew Pinski  ---
Seems fixed in GCC 11+.

[Bug libstdc++/88736] nullptr_t available without namespace qualification

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88736

Andrew Pinski  changed:

   What|Removed |Added

   Keywords|accepts-invalid |
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=54249
  Component|c++ |libstdc++

--- Comment #2 from Andrew Pinski  ---
GCC's gcc/ginclude/stddef.h has:
#if defined(__cplusplus) && __cplusplus >= 201103L
#ifndef _GXX_NULLPTR_T
#define _GXX_NULLPTR_T
  typedef decltype(nullptr) nullptr_t;
#endif
#endif /* C++11.  */

Which was added for PR 54249.

It looks like it is still needed but I think could pull that into
libstdc++/include/c_compatibility/stddef.h instead.

[Bug c++/86669] [7 regression] Complete object constructor clone omits length for a c++11 braced initialiser

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86669

Andrew Pinski  changed:

   What|Removed |Added

 CC||jengelh at inai dot de

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

[Bug c++/88517] Virtual-base class class constructor with for-loop with initializer list referencing local variable not executed

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88517

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
This is fixed in GCC 7.5.0, GCC 8.3.0 and 9+.

THis is actually a dup of bug 86669.

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

[Bug c++/94619] String literals as non-type template parameter fails to compile with partial specialization of calling function

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94619

Andrew Pinski  changed:

   What|Removed |Added

  Known to work||10.3.0, 11.1.0
  Known to fail||10.2.0

--- Comment #3 from Andrew Pinski  ---
Seems to be fixed in GCC 10.3.0 and 11+.

[Bug c++/86369] constexpr const char* comparison fails

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86369

--- Comment #3 from Andrew Pinski  ---
GCC accepts both with GCC 10+.

[Bug c++/82204] G++ doesn't connect friend and extern declarations

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82204

--- Comment #3 from Andrew Pinski  ---
Seems fixed in GCC 11+.

[Bug c++/85612] ADL lookup with parameter pack and defaulted argument not considered ambiguous

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85612

--- Comment #1 from Andrew Pinski  ---
GCC, ICC, clang and MSVC all reject this code the same way.

[Bug c++/54367] [meta-bug] lambda expressions

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54367
Bug 54367 depends on bug 81700, which changed state.

Bug 81700 Summary: Unresolved function type when taking address of operator() 
of generic lambda
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81700

   What|Removed |Added

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

[Bug c++/81700] Unresolved function type when taking address of operator() of generic lambda

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81700

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
Fixed in 9.4, 10.3.0 and 11+.  Most likely by the patch which fixed PR  95675.

Go patch committed: Be strict about escape analysis of builtin functions

2021-08-04 Thread Ian Lance Taylor via Gcc-patches
This Go frontend patch by Cherry Mui makes the escape analysis pass
stricter about builtin functions  In the places where we handle
builtin functions, list all supported ones, and fail if an unexpected
one is seen. So if a new builtin function is added in the future we
can detect it, instead of silently treating it as nonescaping.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian
5b720746d8456986f4bb6b53d30b462f93ff58c4
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index be1a90f7aa1..394530c1cbc 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-616ee658a6238e7de53592ebda5997f6de6a00de
+b47bcf942daa9a0c252db9b57b8f138adbfcdaa2
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/escape.cc b/gcc/go/gofrontend/escape.cc
index 347ac2534c9..c8978ac9239 100644
--- a/gcc/go/gofrontend/escape.cc
+++ b/gcc/go/gofrontend/escape.cc
@@ -1608,8 +1608,33 @@ Escape_analysis_assign::expression(Expression** pexpr)
 }
 break;
 
-  default:
+  case Builtin_call_expression::BUILTIN_CLOSE:
+  case Builtin_call_expression::BUILTIN_DELETE:
+  case Builtin_call_expression::BUILTIN_PRINT:
+  case Builtin_call_expression::BUILTIN_PRINTLN:
+  case Builtin_call_expression::BUILTIN_LEN:
+  case Builtin_call_expression::BUILTIN_CAP:
+  case Builtin_call_expression::BUILTIN_COMPLEX:
+  case Builtin_call_expression::BUILTIN_REAL:
+  case Builtin_call_expression::BUILTIN_IMAG:
+  case Builtin_call_expression::BUILTIN_RECOVER:
+  case Builtin_call_expression::BUILTIN_ALIGNOF:
+  case Builtin_call_expression::BUILTIN_OFFSETOF:
+  case Builtin_call_expression::BUILTIN_SIZEOF:
+// these do not escape.
+break;
+
+  case Builtin_call_expression::BUILTIN_ADD:
+  case Builtin_call_expression::BUILTIN_SLICE:
+// handled in ::assign.
 break;
+
+  case Builtin_call_expression::BUILTIN_MAKE:
+  case Builtin_call_expression::BUILTIN_NEW:
+// should have been lowered to runtime calls at this point.
+// fallthrough
+  default:
+go_unreachable();
   }
 break;
   }
@@ -2372,8 +2397,35 @@ Escape_analysis_assign::assign(Node* dst, Node* src)
 }
 break;
 
-  default:
+  case Builtin_call_expression::BUILTIN_LEN:
+  case Builtin_call_expression::BUILTIN_CAP:
+  case Builtin_call_expression::BUILTIN_COMPLEX:
+  case Builtin_call_expression::BUILTIN_REAL:
+  case Builtin_call_expression::BUILTIN_IMAG:
+  case Builtin_call_expression::BUILTIN_RECOVER:
+  case Builtin_call_expression::BUILTIN_ALIGNOF:
+  case Builtin_call_expression::BUILTIN_OFFSETOF:
+  case Builtin_call_expression::BUILTIN_SIZEOF:
+// these do not escape.
+break;
+
+  case Builtin_call_expression::BUILTIN_COPY:
+// handled in ::expression.
 break;
+
+  case Builtin_call_expression::BUILTIN_CLOSE:
+  case Builtin_call_expression::BUILTIN_DELETE:
+  case Builtin_call_expression::BUILTIN_PRINT:
+  case Builtin_call_expression::BUILTIN_PRINTLN:
+  case Builtin_call_expression::BUILTIN_PANIC:
+// these do not have result.
+// fallthrough
+  case Builtin_call_expression::BUILTIN_MAKE:
+  case Builtin_call_expression::BUILTIN_NEW:
+// should have been lowered to runtime calls at this point.
+// fallthrough
+  default:
+go_unreachable();
   }
 break;
   }


[Bug c++/43064] improve location and text of diagnostics in constructor initializer lists

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43064

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |9.0

[Bug c++/85514] g++ accepts invalid template code

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85514

--- Comment #2 from Andrew Pinski  ---
clang started to accept this code in clang 5.0.0.
ICC started to accept it between 13 and 16.
MSVC started to accept it in v19.23 (19.23.28105.4).

So I think this one can be closed as invalid.

[Bug c++/101786] P1143R2 constinit implementation is incomplete (joining with thread_local)

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101786

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
Confirmed.  We most likely could get rid of the check in this case.  It is a
missed optimization only really.

[Bug c++/101786] P1143R2 constinit implementation is incomplete (joining with thread_local)

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101786

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
   Severity|normal  |minor

--- Comment #1 from Andrew Pinski  ---
_ZTH1x must have been declared as weak.

[Bug c++/66839] g++ accepts NSDMI with -std=c++98 when the intializer is a macro defined in a standard header

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66839

Andrew Pinski  changed:

   What|Removed |Added

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

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

[Bug c++/101786] New: P1143R2 constinit implementation is incomplete (joining with thread_local)

2021-08-04 Thread jpegqs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101786

Bug ID: 101786
   Summary: P1143R2 constinit implementation is incomplete
(joining with thread_local)
   Product: gcc
   Version: 10.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jpegqs at gmail dot com
CC: mpolacek at gcc dot gnu.org
  Target Milestone: ---

The paper says:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1143r2.html

> constinit can also be useful to compilers for non-initializing declarations
> of thread_local variables:
> 
> extern thread_local constinit x;
> int f() { return x; }
> 
> Without constinit, runtime code must be executed to perform a check of a
> guard variable and conditionally initialize x each time it is used. (Other
> techniques exist, but this approach is common.) If the variable is known to
> have constant initialization, this can be avoided.

Let's fix the missing type for x and try:

extern thread_local constinit int x;
int f() { return x; }

In case of compilation, GCC does not remove the TLS wrapper function as it
should according to this paper:

_ZTW1x:
pushrbp
mov rbp, rsp
mov eax, OFFSET FLAT:_ZTH1x
testrax, rax
je  .L2
call_ZTH1x
.L2:
mov rdx, QWORD PTR fs:0
mov rax, QWORD PTR x@gottpoff[rip]
add rax, rdx
pop rbp
ret
_Z1fv:
pushrbp
mov rbp, rsp
call_ZTW1x
mov eax, DWORD PTR [rax]
pop rbp
ret

The code it should produce should look like this: 

_Z1fv:
pushrbp
mov rbp, rsp
mov rax, QWORD PTR x@gottpoff[rip]
mov eax, DWORD PTR fs:[rax]
pop rbp
ret

What I can get now is only by replacing "thread_local constinit" with
"__thread".

Clang implements this feature.

[Bug c++/61543] static_cast(static_cast(enum_value)) doesn't get an error

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61543

Andrew Pinski  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
   Target Milestone|--- |9.0
  Known to work||9.1.0
 Resolution|--- |FIXED

--- Comment #5 from Andrew Pinski  ---
GCC 8+ rejects the first "// accepted" in the reduced testcase.
GCC 9+ rejects both.

Note both are only with C++11 standard (or greater).

Because in C++98 the constant expression which evulates to 0 is considered a
null pointer :).

[Bug c++/80651] Non-type template argument deduction fails

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80651

--- Comment #1 from Andrew Pinski  ---
Seems fixed in GCC 11.

[Bug c++/88092] class nontype template deduction failed when providing type to class

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88092

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |10.0

[Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57466

--- Comment #19 from Andrew Pinski  ---
(In reply to Jonathan Wakely from comment #17)
> Fine by me.
> 
> EDG agrees with GCC, but Clang accepts the original example. I guess they'll
> change when 1584 gets resolved.

clang started to reject in clang 7.0.0.

Is there anything else that needs to be done?

[Bug c++/81051] virtual base access during construction crashes

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81051

--- Comment #3 from Andrew Pinski  ---
The vtable is not set until after the call of the constructor of B::B which is
after the call to f(this).  When is the vtable supposed to be put in the this
object?

[Bug c++/79416] Internal compiler error for recursive template expansion

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79416

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||compile-time-hog,
   ||memory-hog
   Severity|normal  |minor
   Target Milestone|5.5 |---

[Bug c++/79735] C++14: syntax error in attribute deprecated silently ignored

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79735

Andrew Pinski  changed:

   What|Removed |Added

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

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

[Bug c++/18296] Misleading diagnostic for recursive template instantiation

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18296
Bug 18296 depends on bug 15538, which changed state.

Bug 15538 Summary: Misleading diagnostic for recursive template instantiation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15538

   What|Removed |Added

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

[Bug c++/15538] Misleading diagnostic for recursive template instantiation

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15538

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #10 from Andrew Pinski  ---
Fixed by r7-4510.

[Bug c++/15538] Misleading diagnostic for recursive template instantiation

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15538

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |7.0

--- Comment #9 from Andrew Pinski  ---
(In reply to Martin Sebor from comment #8)
> No change in GCC 7.0.

> t.C: In instantiation of ‘struct A >’:
> t.C:5:8:   required from ‘struct H’
> t.C:7:9:   required from here
> t.C:2:26: error: invalid use of incomplete type ‘struct H’
>  struct A { typename D::Q r;};
>   ^
> t.C:5:8: note: declaration of ‘struct H’
>  struct H : A > { typedef G* Q; };
> ^

No that is what we want.  Before it was "no type named 'Q' in 'struct
H'".

[Bug c++/55004] [meta-bug] constexpr issues

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004
Bug 55004 depends on bug 86607, which changed state.

Bug 86607 Summary: constexpr function does not treat function pointers with 
external linkage as constexpr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86607

   What|Removed |Added

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

[Bug c++/77911] Comparing function pointers in a constexpr function can produce an error.

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77911

Andrew Pinski  changed:

   What|Removed |Added

 CC||tadeus.prastowo at unitn dot it

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

[Bug c++/86607] constexpr function does not treat function pointers with external linkage as constexpr

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86607

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
This is a dup of bug 77911.

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

[Bug c++/77911] Comparing function pointers in a constexpr function can produce an error.

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77911

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2021-08-05
 Depends on||69681
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #4 from Andrew Pinski  ---
Confirmed,  I suspect this is the same problem as PR 69681.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69681
[Bug 69681] C/C++ FEs do not consider comparisons of distinct function pointers
to be constant expressions

[Bug c++/77815] access to destructor via decltype-specifier

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77815

Andrew Pinski  changed:

   What|Removed |Added

 CC||xmh970252187 at gmail dot com

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

[Bug c++/99262] The decltype-specifier that denotes a destructor in a function call is rejected by GCC

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99262

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
This is a dup of bug 77815.

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

[Bug c++/101603] [meta-bug] pointer to member functions issues

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101603
Bug 101603 depends on bug 74744, which changed state.

Bug 74744 Summary: Fails to select overridden function when determined by 
template parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=74744

   What|Removed |Added

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

[Bug c++/74744] Fails to select overridden function when determined by template parameter

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=74744

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
Fixed in GCC 8+.

[Bug c++/88538] parse error with class nontype template parameter

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88538

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |9.0

[PATCH] rs6000: Add vec_unpacku_{hi,lo}_v4si

2021-08-04 Thread Kewen.Lin via Gcc-patches
Hi,

The existing vec_unpacku_{hi,lo} supports emulated unsigned
unpacking for short and char but misses the support for int.
This patch adds the support for vec_unpacku_{hi,lo}_v4si.

Meanwhile, the current implementation uses vector permutation
way, which requires one extra customized constant vector as
the permutation control vector.  It's better to use vector
merge high/low with zero constant vector, to save the space
in constant area as well as the cost to initialize pcv in
prologue.  This patch updates it with vector merging and
simplify it with iterators.

Bootstrapped & regtested on powerpc64le-linux-gnu P9 and
powerpc64-linux-gnu P8.

btw, the loop in unpack-vectorize-2.c doesn't get vectorized
without this patch, unpack-vectorize-[13]* is to verify
the vector merging and simplification works expectedly.

Is it ok for trunk?

BR,
Kewen
-
gcc/ChangeLog:

* config/rs6000/altivec.md (vec_unpacku_hi_v16qi): Remove.
(vec_unpacku_hi_v8hi): Likewise.
(vec_unpacku_lo_v16qi): Likewise.
(vec_unpacku_lo_v8hi): Likewise.
(vec_unpacku_hi_): New define_expand.
(vec_unpacku_lo_): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/unpack-vectorize-1.c: New test.
* gcc.target/powerpc/unpack-vectorize-1.h: New test.
* gcc.target/powerpc/unpack-vectorize-2.c: New test.
* gcc.target/powerpc/unpack-vectorize-2.h: New test.
* gcc.target/powerpc/unpack-vectorize-3.c: New test.
* gcc.target/powerpc/unpack-vectorize-3.h: New test.
* gcc.target/powerpc/unpack-vectorize-run-1.c: New test.
* gcc.target/powerpc/unpack-vectorize-run-2.c: New test.
* gcc.target/powerpc/unpack-vectorize-run-3.c: New test.
* gcc.target/powerpc/unpack-vectorize.h: New test.
---
 gcc/config/rs6000/altivec.md  | 158 --
 .../gcc.target/powerpc/unpack-vectorize-1.c   |  18 ++
 .../gcc.target/powerpc/unpack-vectorize-1.h   |  14 ++
 .../gcc.target/powerpc/unpack-vectorize-2.c   |  12 ++
 .../gcc.target/powerpc/unpack-vectorize-2.h   |   7 +
 .../gcc.target/powerpc/unpack-vectorize-3.c   |  11 ++
 .../gcc.target/powerpc/unpack-vectorize-3.h   |   7 +
 .../powerpc/unpack-vectorize-run-1.c  |  24 +++
 .../powerpc/unpack-vectorize-run-2.c  |  16 ++
 .../powerpc/unpack-vectorize-run-3.c  |  16 ++
 .../gcc.target/powerpc/unpack-vectorize.h |  42 +
 11 files changed, 196 insertions(+), 129 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/unpack-vectorize-1.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/unpack-vectorize-1.h
 create mode 100644 gcc/testsuite/gcc.target/powerpc/unpack-vectorize-2.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/unpack-vectorize-2.h
 create mode 100644 gcc/testsuite/gcc.target/powerpc/unpack-vectorize-3.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/unpack-vectorize-3.h
 create mode 100644 gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-1.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-2.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/unpack-vectorize-run-3.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/unpack-vectorize.h

diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index d70c17e6bc2..0e8b66cd6a5 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -134,10 +134,8 @@ (define_c_enum "unspec"
UNSPEC_VMULWLUH
UNSPEC_VMULWHSH
UNSPEC_VMULWLSH
-   UNSPEC_VUPKHUB
-   UNSPEC_VUPKHUH
-   UNSPEC_VUPKLUB
-   UNSPEC_VUPKLUH
+   UNSPEC_VUPKHUBHW
+   UNSPEC_VUPKLUBHW
UNSPEC_VPERMSI
UNSPEC_VPERMHI
UNSPEC_INTERHI
@@ -3885,143 +3883,45 @@ (define_insn "xxeval"
[(set_attr "type" "vecsimple")
 (set_attr "prefixed" "yes")])
 
-(define_expand "vec_unpacku_hi_v16qi"
-  [(set (match_operand:V8HI 0 "register_operand" "=v")
-(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
- UNSPEC_VUPKHUB))]
-  "TARGET_ALTIVEC"  
-{  
-  rtx vzero = gen_reg_rtx (V8HImode);
-  rtx mask = gen_reg_rtx (V16QImode);
-  rtvec v = rtvec_alloc (16);
-  bool be = BYTES_BIG_ENDIAN;
-   
-  emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
-   
-  RTVEC_ELT (v,  0) = gen_rtx_CONST_INT (QImode, be ? 16 :  7);
-  RTVEC_ELT (v,  1) = gen_rtx_CONST_INT (QImode, be ?  0 : 16);
-  RTVEC_ELT (v,  2) = gen_rtx_CONST_INT (QImode, be ? 16 :  6);
-  RTVEC_ELT (v,  3) = gen_rtx_CONST_INT (QImode, be ?  1 : 16);
-  RTVEC_ELT (v,  4) = gen_rtx_CONST_INT (QImode, be ? 16 :  5);
-  RTVEC_ELT (v,  5) = gen_rtx_CONST_INT (QImode, be ?  2 : 16);
-  RTVEC_ELT (v,  6) = gen_rtx_CONST_INT (QImode, be ? 16 :  4);
-  RTVEC_ELT (v,  7) = gen_rtx_CONST_INT (QImode, be ?  3 : 16);
-  RTVEC_ELT (v,  8) = gen_rtx_CONST_INT (QImode, be ? 16 :  3);
-  RTVEC_ELT (v,  9) = gen_rtx_CONST_INT (QImode, be ?  4 : 16);
-  RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 16 :  2);
-  RTVEC_ELT 

[Bug c++/70585] Bogus 'ambiguous template instantiation' error with partial specializations involving a pack expansion

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70585

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||rejects-valid

--- Comment #1 from Andrew Pinski  ---
GCC and ICC reject it with a similar error message.
Clang and MSVC both accept it.

[Bug c++/70983] False ambiguity on member function rvalue overload using auto

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70983

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
Fixed in GCC 6+.

[Bug c++/70737] Invalid C++ code compiles when using explicit template conversions

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70737

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
Fixed in GCC 6.4.0 and 7+.

[Bug c++/71267] [C++14] recursive metafunction won't compile: no type named 'type'

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71267

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||10.3.0, 11.1.0
  Known to work||11.2.0

--- Comment #2 from Andrew Pinski  ---
Looks fixed in GCC 11.2.0 and GCC12+.

[Bug c++/71502] Fold expression unpacks (I < ...) the wrong way

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71502

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|UNCONFIRMED |RESOLVED

--- Comment #4 from Andrew Pinski  ---
Invalid as explained.

[Bug c++/84464] Pack expansion in mem-initializer-list with expression-list

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84464

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
This looks fixed on the trunk.

[Bug c++/69957] Ambiguous overload due to incorrect partial ordering of V<> and V

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69957

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2021-08-05
   Keywords||rejects-valid
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #1 from Andrew Pinski  ---
GCC and MSVC reject this for similar reasons.
Clang and ICC accept this.

[Bug sanitizer/101744] [12 regression] hwasan new failures since r12-2424

2021-08-04 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101744

--- Comment #6 from Hongtao.liu  ---
(In reply to Martin Liška from comment #5)
> > > ``` 
> > Just want to clarify that it's our developping lam version which is at
> > https://gitlab.com/x86-gcc/gcc/-/tree/users/intel/lam/master
> 
> What can you see for a vanilla GCC compiler?

hwasan is not enabled by x86 on the trunk which means there must be no impact
for a vanilla x86 GCC compiler.

[Bug c++/97819] Pack expansion in member initializer lists nested with their parameter list got rejected.

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97819

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=65422
  Known to fail||11.1.0

--- Comment #2 from Andrew Pinski  ---
This looks fixed on the trunk

[Bug c++/65422] [C++11] Rejected valid double expansion packs.

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65422

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||10.1.0, 11.1.0, 11.2.0,
   ||8.1.0

--- Comment #1 from Andrew Pinski  ---
Looks like this is fixed on the trunk.

[Bug c++/69372] GCC allows array and function types to be caught by reference.

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69372

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2021-08-05
 Status|UNCONFIRMED |NEW
   Keywords|accepts-invalid |wrong-code

--- Comment #2 from Andrew Pinski  ---
Confirmed. ICC and clang does not assert in both cases.

[PATCH,V2 1/3] bpf: Add new -mcore option for BPF CO-RE

2021-08-04 Thread Indu Bhagat via Gcc-patches
-mcore in the BPF backend enables code generation for the CO-RE usecase. LTO is
disabled for CO-RE compilations.

gcc/ChangeLog:

* config/bpf/bpf.c (bpf_option_override): For BPF backend, disable LTO
support when compiling for CO-RE.
* config/bpf/bpf.opt: Add new command line option -mcore.

gcc/testsuite/ChangeLog:

* gcc.target/bpf/core-lto-1.c: New test.
---
 gcc/config/bpf/bpf.c  | 15 +++
 gcc/config/bpf/bpf.opt|  4 
 gcc/testsuite/gcc.target/bpf/core-lto-1.c |  9 +
 3 files changed, 28 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/bpf/core-lto-1.c

diff --git a/gcc/config/bpf/bpf.c b/gcc/config/bpf/bpf.c
index e635f9e..028013e 100644
--- a/gcc/config/bpf/bpf.c
+++ b/gcc/config/bpf/bpf.c
@@ -158,6 +158,21 @@ bpf_option_override (void)
 {
   /* Set the initializer for the per-function status structure.  */
   init_machine_status = bpf_init_machine_status;
+
+  /* To support the portability needs of BPF CO-RE approach, BTF debug
+ information includes the BPF CO-RE relocations.  The information
+ necessary for these relocations is added to the CTF container by the
+ BPF backend.  Enabling LTO poses challenges in the generation of the BPF
+ CO-RE relocations because if LTO is in effect, they need to be
+ generated late in the LTO link phase.  This in turn means the compiler
+ needs to provide means to combine the early and late BTF debug info,
+ similar to DWARF debug info.
+
+ In any case, in absence of linker support for BTF sections at this time,
+ it is acceptable to simply disallow LTO for BPF CO-RE compilations.  */
+
+  if (flag_lto && TARGET_BPF_CORE)
+error ("BPF CO-RE does not support LTO");
 }
 
 #undef TARGET_OPTION_OVERRIDE
diff --git a/gcc/config/bpf/bpf.opt b/gcc/config/bpf/bpf.opt
index 916b53c..e8926f5 100644
--- a/gcc/config/bpf/bpf.opt
+++ b/gcc/config/bpf/bpf.opt
@@ -127,3 +127,7 @@ Generate little-endian eBPF.
 mframe-limit=
 Target Joined RejectNegative UInteger IntegerRange(0, 32767) 
Var(bpf_frame_limit) Init(512)
 Set a hard limit for the size of each stack frame, in bytes.
+
+mcore
+Target Mask(BPF_CORE)
+Generate all necessary information for BPF Compile Once - Run Everywhere.
diff --git a/gcc/testsuite/gcc.target/bpf/core-lto-1.c 
b/gcc/testsuite/gcc.target/bpf/core-lto-1.c
new file mode 100644
index 000..a90dc5b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-lto-1.c
@@ -0,0 +1,9 @@
+/* Test -mcore with -flto.
+  
+   -mcore is used to generate information for BPF CO-RE usecase. To support
+   the generataion of the .BTF and .BTF.ext sections in GCC, -flto is disabled
+   with -mcore.  */
+
+/* { dg-do compile } */
+/* { dg-error "BPF CO-RE does not support LTO" "" { target bpf-*-* } 0 } */
+/* { dg-options "-gbtf -mcore -flto" } */
-- 
1.8.3.1



[PATCH, V2 3/3] dwarf2out: Emit BTF in dwarf2out_finish for BPF CO-RE usecase

2021-08-04 Thread Indu Bhagat via Gcc-patches
DWARF generation is split between early and late phases when LTO is in effect.
This poses challenges for CTF/BTF generation especially if late debug info
generation is desirable, as turns out to be the case for BPF CO-RE.

In case of BPF CO-RE, the BPF backend adds information about CO-RE relocations
to the CTF container. This information is what needs to be emitted as a
separate .BTF.ext section when -more is in effect. Further, each CO-RE
relocation record holds an offset to a string specifying the access to the
structure's field. This means that .BTF string table needs to be modified
"late" in the compilation process. In other words, this implies that the BTF
sections cannot be finalized in dwarf2out_early_finish when -mcore for the BPF
backend is in effect.

Now, the emission of CTF/BTF debug info cannot be moved unconditionally to
dwarf2out_finish because dwarf2out_finish is not invoked at all for the LTO
compile phase for slim LTO objects, thus breaking CTF/BTF generation for other
targets when used with LTO.

The approach taken here in this patch is that -

1. LTO is disabled for BPF CO-RE
The reason to disable LTO for BPF CO-RE is that if LTO is in effect, BPF CO-RE
relocations need to be generated in the LTO link phase _after_ the optimizations
are done. This means we need to devise way to combine early and late BTF. At
this time, in absence of linker support for BTF sections, it makes sense to
steer clear of LTO for BPF CO-RE and bypass the issue.

2. Use a target hook to allow BPF backend to cleanly convey the case when late
finalization of the CTF container is desirable.

So, in other words,

dwarf2out_early_finish
  - Always emit CTF here.
  - if (BTF && ctfc_debuginfo_early_finish_p), emit BTF now.

dwarf2out_finish
  - if (BTF && !ctfc_debuginfo_early_finish_p && !in_lto_p) emit BTF now.
  - Use of in_lto_p to make sure LTO link phase does not affect BTF sections
for other targets.

gcc/ChangeLog:

* dwarf2ctf.c (ctf_debug_finalize): Make it static.
(ctf_debug_early_finish): New definition.
(ctf_debug_finish): Likewise.
* dwarf2ctf.h (ctf_debug_finalize): Remove declaration.
(ctf_debug_early_finish): New declaration.
(ctf_debug_finish): Likewise.
* dwarf2out.c (dwarf2out_finish): Invoke ctf_debug_finish.
(dwarf2out_early_finish): Invoke ctf_debug_early_finish.
---
 gcc/dwarf2ctf.c | 55 +++
 gcc/dwarf2ctf.h |  4 +++-
 gcc/dwarf2out.c |  9 +++--
 3 files changed, 53 insertions(+), 15 deletions(-)

diff --git a/gcc/dwarf2ctf.c b/gcc/dwarf2ctf.c
index 5e8a725..0fa429c 100644
--- a/gcc/dwarf2ctf.c
+++ b/gcc/dwarf2ctf.c
@@ -917,6 +917,27 @@ gen_ctf_type (ctf_container_ref ctfc, dw_die_ref die)
   return type_id;
 }
 
+/* Prepare for output and write out the CTF debug information.  */
+
+static void
+ctf_debug_finalize (const char *filename, bool btf)
+{
+  if (btf)
+{
+  btf_output (filename);
+  btf_finalize ();
+}
+
+  else
+{
+  /* Emit the collected CTF information.  */
+  ctf_output (filename);
+
+  /* Reset the CTF state.  */
+  ctf_finalize ();
+}
+}
+
 bool
 ctf_do_die (dw_die_ref die)
 {
@@ -966,25 +987,35 @@ ctf_debug_init_postprocess (bool btf)
 btf_init_postprocess ();
 }
 
-/* Prepare for output and write out the CTF debug information.  */
+/* Early finish CTF/BTF debug info.  */
 
 void
-ctf_debug_finalize (const char *filename, bool btf)
+ctf_debug_early_finish (const char * filename)
 {
-  if (btf)
+  /* Emit CTF debug info early always.  */
+  if (ctf_debug_info_level > CTFINFO_LEVEL_NONE
+  /* Emit BTF debug info early if the target does not require late
+emission.  */
+   || (btf_debuginfo_p ()
+  && targetm.ctfc_debuginfo_early_finish_p ()))
 {
-  btf_output (filename);
-  btf_finalize ();
+  /* Emit CTF/BTF debug info.  */
+  ctf_debug_finalize (filename, btf_debuginfo_p ());
 }
+}
 
-  else
-{
-  /* Emit the collected CTF information.  */
-  ctf_output (filename);
+/* Finish CTF/BTF debug info emission.  */
 
-  /* Reset the CTF state.  */
-  ctf_finalize ();
-}
+void
+ctf_debug_finish (const char * filename)
+{
+  /* Emit BTF debug info here when the target needs to update the CTF container
+ (ctfc) in the backend.  An example of this, at this time is the BPF CO-RE
+ usecase.  */
+  if (btf_debuginfo_p ()
+  && (!in_lto_p && !targetm.ctfc_debuginfo_early_finish_p ()))
+/* Emit BTF debug info.  */
+ctf_debug_finalize (filename, btf_debuginfo_p ());
 }
 
 #include "gt-dwarf2ctf.h"
diff --git a/gcc/dwarf2ctf.h b/gcc/dwarf2ctf.h
index a3cf567..9edbde0 100644
--- a/gcc/dwarf2ctf.h
+++ b/gcc/dwarf2ctf.h
@@ -24,13 +24,15 @@ along with GCC; see the file COPYING3.  If not see
 #define GCC_DWARF2CTF_H 1
 
 #include "dwarf2out.h"
+#include "flags.h"
 
 /* Debug Format Interface.  Used in dwarf2out.c.  */
 
 extern void ctf_debug_init 

[PATCH, V2 2/3] targhooks: New target hook for CTF/BTF debug info emission

2021-08-04 Thread Indu Bhagat via Gcc-patches
This patch adds a new target hook to detect if the CTF container can allow the
emission of CTF/BTF debug info at DWARF debug info early finish time. Some
backends, e.g., BPF when generating code for CO-RE usecase, may need to emit
the CTF/BTF debug info sections around the time when late DWARF debug is
finalized (dwarf2out_finish).

gcc/ChangeLog:

* config/bpf/bpf.c (ctfc_debuginfo_early_finish_p): New definition.
(TARGET_CTFC_DEBUGINFO_EARLY_FINISH_P): Undefine and override.
* doc/tm.texi: Regenerated.
* doc/tm.texi.in: Document the new hook.
* target.def: Add a new hook.
* targhooks.c (default_ctfc_debuginfo_early_finish_p): Likewise.
* targhooks.h (default_ctfc_debuginfo_early_finish_p): Likewise.
---
 gcc/config/bpf/bpf.c | 14 ++
 gcc/doc/tm.texi  |  6 ++
 gcc/doc/tm.texi.in   |  2 ++
 gcc/target.def   | 10 ++
 gcc/targhooks.c  |  6 ++
 gcc/targhooks.h  |  2 ++
 6 files changed, 40 insertions(+)

diff --git a/gcc/config/bpf/bpf.c b/gcc/config/bpf/bpf.c
index 028013e..85f6b76 100644
--- a/gcc/config/bpf/bpf.c
+++ b/gcc/config/bpf/bpf.c
@@ -178,6 +178,20 @@ bpf_option_override (void)
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE bpf_option_override
 
+/* Return FALSE iff -mcore has been specified.  */
+
+static bool
+ctfc_debuginfo_early_finish_p (void)
+{
+  if (TARGET_BPF_CORE)
+return false;
+  else
+return true;
+}
+
+#undef TARGET_CTFC_DEBUGINFO_EARLY_FINISH_P
+#define TARGET_CTFC_DEBUGINFO_EARLY_FINISH_P ctfc_debuginfo_early_finish_p
+
 /* Define target-specific CPP macros.  This function in used in the
definition of TARGET_CPU_CPP_BUILTINS in bpf.h */
 
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index cb01528..2d5ff05 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -10400,6 +10400,12 @@ Define this macro if GCC should produce debugging 
output in BTF debug
 format in response to the @option{-gbtf} option.
 @end defmac
 
+@deftypefn {Target Hook} bool TARGET_CTFC_DEBUGINFO_EARLY_FINISH_P (void)
+This target hook returns nonzero if the CTF Container can allow the
+ emission of the CTF/BTF debug info at the DWARF debuginfo early finish
+ time.
+@end deftypefn
+
 @node Floating Point
 @section Cross Compilation and Floating Point
 @cindex cross compilation and floating point
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 4a522ae..05b3c2c 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7020,6 +7020,8 @@ Define this macro if GCC should produce debugging output 
in BTF debug
 format in response to the @option{-gbtf} option.
 @end defmac
 
+@hook TARGET_CTFC_DEBUGINFO_EARLY_FINISH_P
+
 @node Floating Point
 @section Cross Compilation and Floating Point
 @cindex cross compilation and floating point
diff --git a/gcc/target.def b/gcc/target.def
index 68a46aa..44e2251 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -4016,6 +4016,16 @@ clobbered parts of a register altering the frame 
register size",
  machine_mode, (int regno),
  default_dwarf_frame_reg_mode)
 
+/* Return nonzero if CTF Container can finalize the CTF/BTF emission
+   at DWARF debuginfo early finish time.  */
+DEFHOOK
+(ctfc_debuginfo_early_finish_p,
+ "This target hook returns nonzero if the CTF Container can allow the\n\
+ emission of the CTF/BTF debug info at the DWARF debuginfo early finish\n\
+ time.",
+ bool, (void),
+ default_ctfc_debuginfo_early_finish_p)
+
 /* If expand_builtin_init_dwarf_reg_sizes needs to fill in table
entries not corresponding directly to registers below
FIRST_PSEUDO_REGISTER, this hook should generate the necessary
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index eb51909..e38566c 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -2112,6 +2112,12 @@ default_dwarf_frame_reg_mode (int regno)
   return save_mode;
 }
 
+bool
+default_ctfc_debuginfo_early_finish_p (void)
+{
+  return true;
+}
+
 /* To be used by targets where reg_raw_mode doesn't return the right
mode for registers used in apply_builtin_return and apply_builtin_arg.  */
 
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index f92e102..55dc443 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -255,6 +255,8 @@ extern unsigned int default_dwarf_poly_indeterminate_value 
(unsigned int,
unsigned int *,
int *);
 extern machine_mode default_dwarf_frame_reg_mode (int);
+extern bool default_ctfc_debuginfo_early_finish_p (void);
+
 extern fixed_size_mode default_get_reg_raw_mode (int);
 extern bool default_keep_leaf_when_profiled ();
 
-- 
1.8.3.1



[PATCH,V2 0/3] Allow means for late BTF generation for BPF CO-RE

2021-08-04 Thread Indu Bhagat via Gcc-patches
[Changes from V1]
- [1/3] bpf: Add new -mcore option for BPF CO-RE
  Moved the testcase from gcc.dg/debug/btf/ to gcc.target/bpf/. Adjusted the
  testcase a bit.
- targhooks: New target hook for CTF/BTF debug info emission
  (Same as V1)
- dwarf2out: Emit BTF in dwarf2out_finish for BPF CO-RE usecase
  Moved the call to ctf_debug_finish (in dwarf2out_finish) before the point of
  early exit taken when dwarf_debuginfo_p () is false.
[End of Changes from V1]


Hello,

This patch series puts the framework in place for late BTF generation (in
dwarf2out_finish). This is needed for the landing of BPF CO-RE support in GCC,
patches for which were posted recently
https://gcc.gnu.org/pipermail/gcc-patches/2021-August/576719.html.

BPF's Compile Once - Run Everywhere (CO-RE) feature is used to make a compiled 
BPF program portable across kernel versions, all this without the need to
recompile the BPF program. A key part of BPF CO-RE capability is the BTF debug
info generated for them.

A traditional BPF program (non CO-RE) will have a .BTF section which contains
the type information in the BTF debug format. In case of CO-RE, however, an 
additional section .BTF.ext section is generated. The .BTF.ext section contains
the CO-RE relocations. A BPF loader will use the .BTF.ext section along with the
associated .BTF.ext section to adjust some references in the instructions of
program to ensure it is compatible with the required kernel version / headers.

Roughly, each CO-RE relocation record will contain the following info
 - offset of BPF instruction to be patched
 - the BTF ID of the data structure being accessed by the instruction, and 
 - an offset to the BTF string which encodes a series of field accesses to
   retrieve the field of interest in the instruction.

High-level design
-
- The CTF container is populated with the compiler-internal representation for
the "type information" at dwarf2out_early_finish time.
- In case of CO-RE compilation, the information needed to generate .BTF.ext
section is added by the BPF backend to the CTF container (CTFC) at XXX time.
This introduces challenges in having LTO support for CO-RE - CO-RE relocations
can only be generated late, much like late DWARF. 
- Combining late and early BTF is not being done as the patch set disables LTO
to be used together with CO-RE for the BPF target.
- A new target hook is added for the CTFC (CTF Container) to know whether early
emission of CTF/BTF is allowed for the target.

Testing Notes

- Bootstrapped and reg tested on x86_64
- make all-gcc for --target=bpf-unknown-none; tested ctf.exp, btf.exp and 
bpf.exp

Thanks,
Indu Bhagat (3):
  bpf: Add new -mcore option for BPF CO-RE
  targhooks: New target hook for CTF/BTF debug info emission
  dwarf2out: Emit BTF in dwarf2out_finish for BPF CO-RE usecase

 gcc/config/bpf/bpf.c  | 29 
 gcc/config/bpf/bpf.opt|  4 +++
 gcc/doc/tm.texi   |  6 
 gcc/doc/tm.texi.in|  2 ++
 gcc/dwarf2ctf.c   | 55 ---
 gcc/dwarf2ctf.h   |  4 ++-
 gcc/dwarf2out.c   |  9 +++--
 gcc/target.def| 10 ++
 gcc/targhooks.c   |  6 
 gcc/targhooks.h   |  2 ++
 gcc/testsuite/gcc.target/bpf/core-lto-1.c |  9 +
 11 files changed, 121 insertions(+), 15 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/bpf/core-lto-1.c

-- 
1.8.3.1



[Bug c++/80176] [5/6 Regression] cannot bind reference to static member function using object access expression

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80176

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

[Bug c++/68386] error: invalid initialization of reference of type 'void (&&)()' from expression of type 'void()'

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68386

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
  Known to work||6.4.0, 7.1.0
 Status|NEW |RESOLVED
   Target Milestone|--- |6.4

--- Comment #3 from Andrew Pinski  ---
Fixed in GCC 6.4.0 and GCC7+.

This is a dup of bug 80176.

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

[Bug c++/69302] parentheses cause address of register variable to be requested (c++1y)

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69302

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #7 from Andrew Pinski  ---
Fixed in GCC 8+.

Note GCC11+ default to C++17 and register storage class is rejected.

[Bug target/101785] aarch64-linux-android is not supported

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101785

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

[Bug libgcc/99964] android(bionic) cannot find crti.o and crtn.o on aarch64

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99964

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #10 from Andrew Pinski  ---
There is really no support for aarch64-linux-android included.  The target
headers for aarch64 don't include any support at all.

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

[Bug c++/68077] Namespace having the same name as contained class should not compile

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68077

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=68188
   Keywords||accepts-invalid
 Ever confirmed|0   |1
   Last reconfirmed||2021-08-05
 Status|UNCONFIRMED |NEW

--- Comment #1 from Andrew Pinski  ---
Confirmed. related to PR 68188.

[Bug sanitizer/101784] __NR_newfstatat is not defined on aarch64-linux-android

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101784

--- Comment #8 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #7)
> (In reply to cqwrteur from comment #6)
> > (In reply to Andrew Pinski from comment #5)
> > > Dup of bug 101785 really.  There is no supported at all included.
> > > 
> > > *** This bug has been marked as a duplicate of bug 101785 ***
> > 
> > but i am sure __NR_newfstatat does not exist on linux kernel header files
> > for aarch64 anymore.
> 
> It does.
> asm-generic/unistd.h:
> 
> #define __NR3264_fstatat 79
> __SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
> 
> 
> #define __NR_newfstatat __NR3264_fstatat

This is 4.14's headers but I really doubt they have changed that much since
then.

[Bug sanitizer/101784] __NR_newfstatat is not defined on aarch64-linux-android

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101784

--- Comment #7 from Andrew Pinski  ---
(In reply to cqwrteur from comment #6)
> (In reply to Andrew Pinski from comment #5)
> > Dup of bug 101785 really.  There is no supported at all included.
> > 
> > *** This bug has been marked as a duplicate of bug 101785 ***
> 
> but i am sure __NR_newfstatat does not exist on linux kernel header files
> for aarch64 anymore.

It does.
asm-generic/unistd.h:

#define __NR3264_fstatat 79
__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)


#define __NR_newfstatat __NR3264_fstatat

[Bug sanitizer/101784] __NR_newfstatat is not defined on aarch64-linux-android

2021-08-04 Thread unlvsur at live dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101784

--- Comment #6 from cqwrteur  ---
(In reply to Andrew Pinski from comment #5)
> Dup of bug 101785 really.  There is no supported at all included.
> 
> *** This bug has been marked as a duplicate of bug 101785 ***

but i am sure __NR_newfstatat does not exist on linux kernel header files for
aarch64 anymore.

[Bug target/101785] aarch64-linux-android is not supported

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101785

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

[Bug sanitizer/101784] __NR_newfstatat is not defined on aarch64-linux-android

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101784

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #5 from Andrew Pinski  ---
Dup of bug 101785 really.  There is no supported at all included.

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

[Bug sanitizer/101784] __NR_newfstatat is not defined on aarch64-linux-android

2021-08-04 Thread unlvsur at live dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101784

--- Comment #4 from cqwrteur  ---
(In reply to Andrew Pinski from comment #3)
> This is a bug in android headers.
> 
> I really doubt anyone really cares enough about gcc support for android
> these days.  I also really double anyone has really ported aarch64 android
> support to gcc. Google moved over to clang/llvm around the same time as
> moving to armv8.

I do care tbh.

Google does not care that is their fault.

[Bug target/101785] Android macro is not defined for aarch64-linux-android

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101785

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Keywords||build

--- Comment #1 from Andrew Pinski  ---
ANDROID_TARGET_OS_CPP_BUILTINS is not called from TARGET_OS_CPP_BUILTINS in
config/aarch64/aarch64-linux.h .


That is there is no support for android for aarch64 at all.

Modifying self

2021-08-04 Thread Mark Wielaard
Hi,

I am trying to get this program working:

extern "C" { fn abort (); }

pub struct H
{
  l: u32,
}

impl H
{
  fn p ( self) -> u32
  {
self.l -= 1;
self.l
  }
}

fn main ()
{
  let mut h = H { l: 11 }; 
  let eleven = h.l; 
  let ten = h.p (); 
  if ten + 1 != eleven { unsafe { abort (); } } 
  let h2 = H { l: ten }; 
  if h.l != h2.l { unsafe { abort (); } } 
}

This doesn't currently compile:

$ gcc/gccrs -Bgcc -g p.rs 
p.rs:12:5: error: invalid left-hand side of assignment
   12 | self.l -= 1;
  | ^

But this isn't too hard to solve:

diff --git a/gcc/rust/resolve/rust-ast-verify-assignee.h 
b/gcc/rust/resolve/rust-ast-verify-assignee.h
index aed01196f81..1e8988d47df 100644
--- a/gcc/rust/resolve/rust-ast-verify-assignee.h
+++ b/gcc/rust/resolve/rust-ast-verify-assignee.h
@@ -75,6 +75,13 @@ public:
   }
   }
 
+  void visit (AST::PathInExpression ) override
+  {
+/* XXX do we need to check self is mutable? How?  */
+if (path.as_string () == "self")
+  ok = true;
+  }
+
 private:
   VerifyAsignee (NodeId parent) : ResolverBase (parent), ok (false) {}
 
I am not sure whether this is a good implementation of the
VerifyAsignee visitor for a PathInExpression. What exactly is the goal
of this visitor?

But with the above simple fix, it compiles! And it actually seems to
mostly work. The implementation method is called, it gets its own
field, substracts the value and correctly returns it!

But... then it still aborts on the second check.  The method was
supposed to adjust the given self (H), but it is not given a mutable
reference, it gets a copy...

On irc Philip suggested this is probably
https://github.com/Rust-GCC/gccrs/issues/241

But I must admit I don't fully understand what really needs to be done
here or if the fact that this is a  self makes it different from a
 argument.

Cheers,

Mark

-- 
Gcc-rust mailing list
Gcc-rust@gcc.gnu.org
https://gcc.gnu.org/mailman/listinfo/gcc-rust


[Bug sanitizer/101784] __NR_newfstatat is not defined on aarch64-linux-android

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101784

--- Comment #3 from Andrew Pinski  ---
This is a bug in android headers.

I really doubt anyone really cares enough about gcc support for android these
days.  I also really double anyone has really ported aarch64 android support to
gcc. Google moved over to clang/llvm around the same time as moving to armv8.

[Bug c++/101785] New: Android macro is not defined for aarch64-linux-android

2021-08-04 Thread unlvsur at live dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101785

Bug ID: 101785
   Summary: Android macro is not defined for aarch64-linux-android
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: unlvsur at live dot com
  Target Milestone: ---

int main()
{
#if defined(__ANDROID__) || defined(__BIONIC__) || defined(ANDROID)
dgdsg;
#endif
}

aarch64-linux-android-g++ -c a.cc

compilation success. ANDROID macro is not defined

[Bug sanitizer/101784] __NR_newfstatat is not defined on aarch64-linux-android

2021-08-04 Thread unlvsur at live dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101784

--- Comment #2 from cqwrteur  ---
Created attachment 51264
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51264=edit
more errors

Re: daily report on extending static analyzer project [GSoC]

2021-08-04 Thread David Malcolm via Gcc
On Wed, 2021-08-04 at 21:32 +0530, Ankur Saini wrote:

[...snip...]
> 
> - From observation, a typical vfunc call that isn't devirtualised by
> the compiler's front end looks something like this 
> "OBJ_TYPE_REF(_2;(struct A)a_ptr_5(D)->0) (a_ptr_5(D))"
> where "a_ptr_5(D)" is pointer that is being used to call the virtual
> function.
> 
> - We can access it's region to see what is the type of the object the
> pointer is actually pointing to.
> 
> - This is then used to find a call with DECL_CONTEXT of the object
> from the all the possible targets of that polymorphic call.

[...]

> 
> Patch file ( prototype ) : 
> 

> +  /* Call is possibly a polymorphic call.
> +  
> + In such case, use devirtisation tools to find 
> + possible callees of this function call.  */
> +  
> +  function *fun = get_current_function ();
> +  gcall *stmt  = const_cast (call);
> +  cgraph_edge *e = cgraph_node::get (fun->decl)->get_edge (stmt);
> +  if (e->indirect_info->polymorphic)
> +  {
> +void *cache_token;
> +bool final;
> +vec  targets
> +  = possible_polymorphic_call_targets (e, , _token, true);
> +if (!targets.is_empty ())
> +  {
> +tree most_propbable_taget = NULL_TREE;
> +if(targets.length () == 1)
> + return targets[0]->decl;
> +
> +/* From the current state, check which subclass the pointer that 
> +   is being used to this polymorphic call points to, and use to
> +   filter out correct function call.  */
> +tree t_val = gimple_call_arg (call, 0);

Maybe rename to "this_expr"?


> +const svalue *sval = get_rvalue (t_val, ctxt);

and "this_sval"?

...assuming that that's what the value is.

Probably should reject the case where there are zero arguments.


> +
> +const region *reg
> +  = [&]()->const region *
> +  {
> +switch (sval->get_kind ())
> +  {
> +case SK_INITIAL:
> +  {
> +const initial_svalue *initial_sval
> +  = sval->dyn_cast_initial_svalue ();
> +return initial_sval->get_region ();
> +  }
> +  break;
> +case SK_REGION:
> +  {
> +const region_svalue *region_sval 
> +  = sval->dyn_cast_region_svalue ();
> +return region_sval->get_pointee ();
> +  }
> +  break;
> +
> +default:
> +  return NULL;
> +  }
> +  } ();
 
I think the above should probably be a subroutine.

That said, it's not clear to me what it's doing, or that this is correct.

I'm guessing that you need to see if
  *((void **)this)
is a vtable pointer (or something like that), and, if so, which class
it is for.

Is there a way of getting the vtable pointer as an svalue?

> +gcc_assert (reg);
> +
> +tree known_possible_subclass_type;
> +known_possible_subclass_type = reg->get_type ();
> +if (reg->get_kind () == RK_FIELD)
> +  {
> + const field_region* field_reg = reg->dyn_cast_field_region ();
> + known_possible_subclass_type 
> +   = DECL_CONTEXT (field_reg->get_field ());
> +  }
> +
> +for (cgraph_node *x : targets)
> +  {
> +if (DECL_CONTEXT (x->decl) == known_possible_subclass_type)
> +  most_propbable_taget = x->decl;
> +  }
> +return most_propbable_taget;
> +  }
> +   }
> +
>return NULL_TREE;
>  }

Dave




[Bug sanitizer/101784] __NR_newfstatat is not defined on aarch64-linux-android

2021-08-04 Thread unlvsur at live dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101784

--- Comment #1 from cqwrteur  ---
Created attachment 51263
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51263=edit
log file

[Bug sanitizer/101784] New: __NR_newfstatat is not defined on aarch64-linux-android

2021-08-04 Thread unlvsur at live dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101784

Bug ID: 101784
   Summary: __NR_newfstatat is not defined on
aarch64-linux-android
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: unlvsur at live dot com
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---

Created attachment 51262
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51262=edit
error message

../../../../../gcc/libsanitizer/sanitizer_common/sanitizer_syscall_linux_aarch64.inc:13:23:
error: '__NR_newfstatat' was not declared in this scope
   13 | #define SYSCALL(name) __NR_ ## name
  |   ^
../../../../../gcc/libsanitizer/sanitizer_common/sanitizer_syscall_linux_aarch64.inc:80:24:
note: in definition of macro '__internal_syscall4'
   80 |   (__internal_syscall)(n, (u64)(a1), (long)(a2), (long)(a3),
(long)(a4))
  |^

Re: [PATCH 02/34] rs6000: Add gengtype handling to the build machinery

2021-08-04 Thread Segher Boessenkool
On Thu, Jul 29, 2021 at 08:30:49AM -0500, Bill Schmidt wrote:
>   * config.gcc (target_gtfiles): Add ./rs6000-builtins.h.
>   * config/rs6000/t-rs6000 (EXTRA_GTYPE_DEPS): Set.

> --- a/gcc/config/rs6000/t-rs6000
> +++ b/gcc/config/rs6000/t-rs6000
> @@ -22,6 +22,7 @@ TM_H += $(srcdir)/config/rs6000/rs6000-builtin.def
>  TM_H += $(srcdir)/config/rs6000/rs6000-cpus.def
>  TM_H += $(srcdir)/config/rs6000/rs6000-modes.h
>  PASSES_EXTRA += $(srcdir)/config/rs6000/rs6000-passes.def
> +EXTRA_GTYPE_DEPS += $(srcdir)/config/rs6000/rs6000-builtin-new.def
>  
>  rs6000-pcrel-opt.o: $(srcdir)/config/rs6000/rs6000-pcrel-opt.c
>   $(COMPILE) $<

Surprisingly I couldn't find docs or examples for EXTRA_GTYPE_DEPS.
But it loks like it will work.  Okay for trunkm thanks!


Segher


[Bug c++/101782] [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729

2021-08-04 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101782

--- Comment #2 from Jonathan Wakely  ---
I think we can probably do this to stop the test failing:

--- a/gcc/testsuite/g++.dg/cpp2a/concepts-pr67774.C
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-pr67774.C
@@ -1,5 +1,4 @@
 // { dg-do compile { target c++20 } }
-// { dg-additional-options "-fconcepts-ts" }

 #include 
 #include 


Because that flag was present to enable concepts support, but concepts are
always enabled for c++20 now, and it gets run with -std=c++2a

But the FE bug still needs to be fixed.

[Bug tree-optimization/94356] Missed optimisation: useless multiplication generated for pointer comparison

2021-08-04 Thread glisse at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94356

--- Comment #6 from Marc Glisse  ---
(In reply to Andrew Pinski from comment #5)
> Hmm, the following is worse:

That looks like a separate issue. We have fold_comparison for GENERIC, and
match.pd has related patterns for integers, or for pointers with ==, but not
for pointers with <. Strange, I thought I had added those, possibly together
with pointer_diff since the behavior is similar.

Re: [PATCH 01/34] rs6000: Incorporate new builtins code into the build machinery

2021-08-04 Thread Segher Boessenkool
Hi!

On Thu, Jul 29, 2021 at 08:30:48AM -0500, Bill Schmidt wrote:
>   * config/rs6000/rs6000-gen-builtins.c (main): Close init_file
>   last.

That easily fits on one line?

> +rs6000-gen-builtins: rs6000-gen-builtins.o rbtree.o
> + $(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ \
> + $(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS)

I wonder what the difference is between BUILD_LINKERFLAGS and
BUILD_LDFLAGS?  Do you have any idea?

Okay for trunk.  Thanks!


Segher


[Bug c++/101782] [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729

2021-08-04 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101782

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||rejects-valid
   Assignee|redi at gcc dot gnu.org|unassigned at gcc dot 
gnu.org
 Status|ASSIGNED|NEW
  Component|testsuite   |c++

--- Comment #1 from Jonathan Wakely  ---
This is a C++ FE bug.

This valid C++20 code:

template concept foo = true;

template requires foo
[[nodiscard]]
int bar(T) { return 1; }

is rejected with the -fconcepts-ts flag (as both C++20 and C++17):

conc.C:4:1: error: two consecutive ‘[’ shall only introduce an attribute before
‘[’ token
4 | [[nodiscard]]
  | ^

For C++17 mode, -fconcepts-ts defines __cpp_concepts=201507L so we could use
that to suppress the [[nodiscard]] attributes when the flag is given.

But we can't detect it for C++20 mode (which is when the testsuite errors
happen) because C++20 defines __cpp_concepts=201907L and -fconcepts-ts doesn't
change that. So I'm not sure what we can do, other than not apply the attribute
to constrained functions with a requires-clause.

[Bug c++/53660] function pointer conversion function template with nested-name-specifier ignored

2021-08-04 Thread potswa at mac dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53660

--- Comment #2 from David Krauss  ---
(In reply to Andrew Pinski from comment #1)
> I don't think this is a bug.

Right, the behavior looks correct.

As for a nested-name-specifier working in this context, it works if it's not
dependent. As for the declaration being a function template, it works as long
as the conversion-type-id is not dependent.

Oddly, a dependent conversion-type-id *is* allowed when the function is not
templated.

Anyway, the standard says to inspect the conversion function declarations and
find the ones referring to function (-pointer, -reference) types. That doesn't
admit application of template default arguments, as implicit or explicit
conversion does.

[Bug analyzer/101570] [12 Regression] ICE in maybe_reconstruct_from_def_stmt, at analyzer/analyzer.cc:133

2021-08-04 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101570

David Malcolm  changed:

   What|Removed |Added

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

--- Comment #3 from David Malcolm  ---
Should be fixed by the above commit.

[committed] analyzer: initial implementation of asm support [PR101570]

2021-08-04 Thread David Malcolm via Gcc-patches
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as r12-2749-gded2c2c068f6f2825474758cb03a05070a5837e8.

gcc/ChangeLog:
PR analyzer/101570
* Makefile.in (ANALYZER_OBJS): Add analyzer/region-model-asm.o.

gcc/analyzer/ChangeLog:
PR analyzer/101570
* analyzer.cc (maybe_reconstruct_from_def_stmt): Add GIMPLE_ASM
case.
* analyzer.h (class asm_output_svalue): New forward decl.
(class reachable_regions): New forward decl.
* complexity.cc (complexity::from_vec_svalue): New.
* complexity.h (complexity::from_vec_svalue): New decl.
* engine.cc (feasibility_state::maybe_update_for_edge): Handle
asm stmts by calling on_asm_stmt.
* region-model-asm.cc: New file.
* region-model-manager.cc
(region_model_manager::maybe_fold_asm_output_svalue): New.
(region_model_manager::get_or_create_asm_output_svalue): New.
(region_model_manager::log_stats): Log m_asm_output_values_map.
* region-model.cc (region_model::on_stmt_pre): Handle GIMPLE_ASM.
* region-model.h (visitor::visit_asm_output_svalue): New.
(region_model_manager::get_or_create_asm_output_svalue): New decl.
(region_model_manager::maybe_fold_asm_output_svalue): New decl.
(region_model_manager::asm_output_values_map_t): New typedef.
(region_model_manager::m_asm_output_values_map): New field.
(region_model::on_asm_stmt): New.
* store.cc (binding_cluster::on_asm): New.
* store.h (binding_cluster::on_asm): New decl.
* svalue.cc (svalue::cmp_ptr): Handle SK_ASM_OUTPUT.
(asm_output_svalue::dump_to_pp): New.
(asm_output_svalue::dump_input): New.
(asm_output_svalue::input_idx_to_asm_idx): New.
(asm_output_svalue::accept): New.
* svalue.h (enum svalue_kind): Add SK_ASM_OUTPUT.
(svalue::dyn_cast_asm_output_svalue): New.
(class asm_output_svalue): New.
(is_a_helper ::test): New.
(struct default_hash_traits): New.

gcc/testsuite/ChangeLog:
PR analyzer/101570
* gcc.dg/analyzer/asm-x86-1.c: New test.
* gcc.dg/analyzer/asm-x86-lp64-1.c: New test.
* gcc.dg/analyzer/asm-x86-lp64-2.c: New test.
* gcc.dg/analyzer/pr101570.c: New test.
* gcc.dg/analyzer/torture/asm-x86-linux-array_index_mask_nospec.c:
New test.
* gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-1.c: New
test.
* gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-2.c: New
test.
* gcc.dg/analyzer/torture/asm-x86-linux-cpuid.c: New test.
* gcc.dg/analyzer/torture/asm-x86-linux-rdmsr-paravirt.c: New
test.
* gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c: New test.
* gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-full.c:
New test.
* gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-reduced.c:
New test.

Signed-off-by: David Malcolm 
---
 gcc/Makefile.in   |   1 +
 gcc/analyzer/analyzer.cc  |   1 +
 gcc/analyzer/analyzer.h   |   2 +
 gcc/analyzer/complexity.cc|  16 +
 gcc/analyzer/complexity.h |   1 +
 gcc/analyzer/engine.cc|   2 +
 gcc/analyzer/region-model-asm.cc  | 303 +
 gcc/analyzer/region-model-manager.cc  |  48 +++
 gcc/analyzer/region-model.cc  |   5 +-
 gcc/analyzer/region-model.h   |  13 +
 gcc/analyzer/store.cc |  17 +
 gcc/analyzer/store.h  |   1 +
 gcc/analyzer/svalue.cc|  89 +
 gcc/analyzer/svalue.h | 145 +++-
 gcc/testsuite/gcc.dg/analyzer/asm-x86-1.c |  69 
 .../gcc.dg/analyzer/asm-x86-lp64-1.c  | 131 +++
 .../gcc.dg/analyzer/asm-x86-lp64-2.c  |  34 ++
 gcc/testsuite/gcc.dg/analyzer/pr101570.c  |   5 +
 .../asm-x86-linux-array_index_mask_nospec.c   |  74 
 .../torture/asm-x86-linux-cpuid-paravirt-1.c  |  81 +
 .../torture/asm-x86-linux-cpuid-paravirt-2.c  | 135 
 .../analyzer/torture/asm-x86-linux-cpuid.c|  46 +++
 .../torture/asm-x86-linux-rdmsr-paravirt.c| 210 
 .../analyzer/torture/asm-x86-linux-rdmsr.c|  33 ++
 .../asm-x86-linux-wfx_get_ps_timeout-full.c   | 319 ++
 ...asm-x86-linux-wfx_get_ps_timeout-reduced.c |  77 +
 26 files changed, 1855 insertions(+), 3 deletions(-)
 create mode 100644 gcc/analyzer/region-model-asm.cc
 create mode 100644 gcc/testsuite/gcc.dg/analyzer/asm-x86-1.c
 create mode 100644 gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-1.c
 create mode 100644 gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-2.c
 create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr101570.c
 create mode 100644 

[Bug analyzer/101570] [12 Regression] ICE in maybe_reconstruct_from_def_stmt, at analyzer/analyzer.cc:133

2021-08-04 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101570

--- Comment #2 from CVS Commits  ---
The master branch has been updated by David Malcolm :

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

commit r12-2749-gded2c2c068f6f2825474758cb03a05070a5837e8
Author: David Malcolm 
Date:   Wed Aug 4 18:21:21 2021 -0400

analyzer: initial implementation of asm support [PR101570]

gcc/ChangeLog:
PR analyzer/101570
* Makefile.in (ANALYZER_OBJS): Add analyzer/region-model-asm.o.

gcc/analyzer/ChangeLog:
PR analyzer/101570
* analyzer.cc (maybe_reconstruct_from_def_stmt): Add GIMPLE_ASM
case.
* analyzer.h (class asm_output_svalue): New forward decl.
(class reachable_regions): New forward decl.
* complexity.cc (complexity::from_vec_svalue): New.
* complexity.h (complexity::from_vec_svalue): New decl.
* engine.cc (feasibility_state::maybe_update_for_edge): Handle
asm stmts by calling on_asm_stmt.
* region-model-asm.cc: New file.
* region-model-manager.cc
(region_model_manager::maybe_fold_asm_output_svalue): New.
(region_model_manager::get_or_create_asm_output_svalue): New.
(region_model_manager::log_stats): Log m_asm_output_values_map.
* region-model.cc (region_model::on_stmt_pre): Handle GIMPLE_ASM.
* region-model.h (visitor::visit_asm_output_svalue): New.
(region_model_manager::get_or_create_asm_output_svalue): New decl.
(region_model_manager::maybe_fold_asm_output_svalue): New decl.
(region_model_manager::asm_output_values_map_t): New typedef.
(region_model_manager::m_asm_output_values_map): New field.
(region_model::on_asm_stmt): New.
* store.cc (binding_cluster::on_asm): New.
* store.h (binding_cluster::on_asm): New decl.
* svalue.cc (svalue::cmp_ptr): Handle SK_ASM_OUTPUT.
(asm_output_svalue::dump_to_pp): New.
(asm_output_svalue::dump_input): New.
(asm_output_svalue::input_idx_to_asm_idx): New.
(asm_output_svalue::accept): New.
* svalue.h (enum svalue_kind): Add SK_ASM_OUTPUT.
(svalue::dyn_cast_asm_output_svalue): New.
(class asm_output_svalue): New.
(is_a_helper ::test): New.
(struct default_hash_traits): New.

gcc/testsuite/ChangeLog:
PR analyzer/101570
* gcc.dg/analyzer/asm-x86-1.c: New test.
* gcc.dg/analyzer/asm-x86-lp64-1.c: New test.
* gcc.dg/analyzer/asm-x86-lp64-2.c: New test.
* gcc.dg/analyzer/pr101570.c: New test.
* gcc.dg/analyzer/torture/asm-x86-linux-array_index_mask_nospec.c:
New test.
* gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-1.c: New
test.
* gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-2.c: New
test.
* gcc.dg/analyzer/torture/asm-x86-linux-cpuid.c: New test.
* gcc.dg/analyzer/torture/asm-x86-linux-rdmsr-paravirt.c: New
test.
* gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c: New test.
* gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-full.c:
New test.
*
gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-reduced.c:
New test.

Signed-off-by: David Malcolm 

[Bug c++/67048] [9/10/11/12 Regression] GCC rejects well-formed program using empty anonymous enum specifier in a variable declaration

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67048

Andrew Pinski  changed:

   What|Removed |Added

  Known to work||4.8.5
   Target Milestone|--- |9.5
  Known to fail||10.1.0, 11.1.0, 4.9.0,
   ||9.4.0
Summary|GCC rejects well-formed |[9/10/11/12 Regression] GCC
   |program using empty |rejects well-formed program
   |anonymous enum specifier in |using empty anonymous enum
   |a variable declaration  |specifier in a variable
   ||declaration

--- Comment #1 from Andrew Pinski  ---
This was almost definitely caused by PR 54216 .

  1   2   3   4   5   >