[Bug libgcc/109282] Libgcc references sh and not $(SHELL) in Makefile.in

2023-03-25 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109282

Andrew Pinski  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #4 from Andrew Pinski  ---
My bet if you do /bin/sh you would also get into trouble too ...

[Bug libgcc/109282] Libgcc references sh and not $(SHELL) in Makefile.in

2023-03-25 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109282

--- Comment #3 from Andrew Pinski  ---
https://developer.apple.com/forums/thread/701242

[Bug libgcc/109282] Libgcc references sh and not $(SHELL) in Makefile.in

2023-03-25 Thread chrisj at rtems dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109282

--- Comment #2 from Chris Johns  ---
(In reply to Andrew Pinski from comment #1)
> move-if-change should work just fine with a normal POSIX shell ...

It does. Maybe it was not found?

> What is the error message with /bin/sh still there?

The error message was:

/bin/sh: line 1: 16562 Killed: 9   sh
../../../../gnu-mirror-gcc-cf59d86/libgcc/../move-if-change $dest
../../.././gcc/include/unwind.h

This is the only place in the file `sh` is directly referenced like this. I did
not look into this any further as `$(SHELL)` worked.

[Bug libgcc/109282] Libgcc references sh and not $(SHELL) in Makefile.in

2023-03-25 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109282

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2023-03-26
 Ever confirmed|0   |1
 Status|UNCONFIRMED |WAITING

[Bug libgcc/109282] Libgcc references sh and not $(SHELL) in Makefile.in

2023-03-25 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109282

--- Comment #1 from Andrew Pinski  ---
move-if-change should work just fine with a normal POSIX shell ...

What is the error message with /bin/sh still there?

[Bug c++/109283] New: Destructor of co_yield conditional argument called twice

2023-03-25 Thread ncm at cantrip dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109283

Bug ID: 109283
   Summary: Destructor of co_yield conditional argument called
twice
   Product: gcc
   Version: 12.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ncm at cantrip dot org
  Target Milestone: ---

Created attachment 54754
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54754=edit
Reproducer

Basically:

  co_yield a ? s : t;

segfaults,

  if (a) co_yield s; else co_yield t;

does not. The segfault traces to s/t's destructor being called 
twice. Full reproducer attached, relying on Casey Carter's 
generator implementation, pasted in.

This may be related to 101367.

Compiled with gcc-12.2, this program segfaults.
Compiled with gcc-trunk or gcc-coroutines on Godbolt, identified as:

  g++
(Compiler-Explorer-Build-gcc-13ec81eb4c3b484ad636000fa8f6d925e15fb983-binutils-2.38)
13.0.1 20230325 (experimental)

the compiler ICEs:

  :513:1: internal compiler error: in flatten_await_stmt, at
cp/coroutines.cc:2899
  513 | }

[Bug libgcc/109282] New: Libgcc references sh and not $(SHELL) in Makefile.in

2023-03-25 Thread chrisj at rtems dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109282

Bug ID: 109282
   Summary: Libgcc references sh and not $(SHELL) in Makefile.in
   Product: gcc
   Version: 12.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libgcc
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chrisj at rtems dot org
  Target Milestone: ---

Created attachment 54753
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54753=edit
Change sh to $(SHELL)

The libgcc Makefile.in has `sh` and not `$(SHELL)` and that failed on MacOS
Ventura. The attached patch fixes the problem and builds an RTEMS crosscompiler
tool chain.

[Bug target/108928] epiphany-elf: unrecognizable insn (internal compiler error: in extract_insn, at recog.cc:2791) triggered during Modula-2 build

2023-03-25 Thread jbglaw--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108928

--- Comment #1 from Jan-Benedict Glaw  ---
Last confirmed: g:0a846340b99675d57fc2f2923a0412134eed09d3 (cf.
http://toolchain.lug-owl.de/laminar/jobs/gcc-epiphany-elf/36)

[Bug fortran/104321] Dead code since r12-4467-g64f9623765da33

2023-03-25 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104321

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Resolution|--- |FIXED
 CC||anlauf at gcc dot gnu.org
 Status|NEW |RESOLVED

--- Comment #4 from anlauf at gcc dot gnu.org ---
Fixed.

[Bug fortran/104321] Dead code since r12-4467-g64f9623765da33

2023-03-25 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104321

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Harald Anlauf :

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

commit r13-6862-gb5fce899dbbd7246d003209b2fe3b04f8738
Author: Harald Anlauf 
Date:   Sat Mar 25 19:59:45 2023 +0100

Fortran: remove dead code [PR104321]

gcc/fortran/ChangeLog:

PR fortran/104321
* trans-decl.cc (gfc_conv_cfi_to_gfc): Remove dead code.

[Bug tree-optimization/109281] use std::optional results in suboptimal code

2023-03-25 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109281

Andrew Pinski  changed:

   What|Removed |Added

 Depends on||101326, 95405

--- Comment #1 from Andrew Pinski  ---
This is same as PR 95405 and PR 101326


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95405
[Bug 95405] Unnecessary stores with std::optional
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101326
[Bug 101326] std::optional returns forced through stack

[Bug c++/104995] [10/11/12/13 Regression] access checking for function pointer template parameters takes place at call site inside a templated (generic) lambda

2023-03-25 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104995

Patrick Palka  changed:

   What|Removed |Added

Summary|access checking for |[10/11/12/13 Regression]
   |function pointer template   |access checking for
   |parameters takes place at   |function pointer template
   |call site inside a  |parameters takes place at
   |templated (generic) lambda  |call site inside a
   ||templated (generic) lambda
   Target Milestone|--- |10.5
 CC||jason at gcc dot gnu.org,
   ||ppalka at gcc dot gnu.org

--- Comment #3 from Patrick Palka  ---
C++14 testcase exhibiting a regression since GCC 8 / r8-2720-gf44a8dd56f5bfb:

template
void func() {
auto lambda = [&](auto&& s) { F(s); };
lambda(0);
}

struct S {
void f() { func(); }

private:
static void g(int) {}
};

[Bug c++/109277] [13 Regression] type_traits:1417:30: error: invalid use of incomplete type ‘class v8::internal::WasmArray’

2023-03-25 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109277

Patrick Palka  changed:

   What|Removed |Added

   Keywords|needs-bisection,|
   |needs-reduction |

--- Comment #10 from Patrick Palka  ---
Thus started with the move to use the built-in __is_convertible in
std::is_convertible, r13-2883-gaf85ad891703db

(In reply to Patrick Palka from comment #9)
> One fix is to define a move constructor for TNode, which causes GCC's
> perfect candidate optimization (r11-7287-g187d0d5871b1fa) to kick in and
> avoid considering the template candidate #1.  Another fix is to use
> std::conjunction/disjunction in is_subtype so that the condition properly
> short-circuits (is_base_of is true even for incomplete T).

Note that the first proposed fix would just paper over the UB, whereas the
second fix would eliminate it IIUC.

[Bug c++/109277] [13 Regression] type_traits:1417:30: error: invalid use of incomplete type ‘class v8::internal::WasmArray’

2023-03-25 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109277

Patrick Palka  changed:

   What|Removed |Added

 CC||ppalka at gcc dot gnu.org

--- Comment #9 from Patrick Palka  ---
AFAICT the trait instantiation is legitimate, and this appears to be UB, here's
a boiled down testcase:

#include 
#include 

struct Object;
struct MaybeObject;
struct WasmArray;

template
struct is_subtype {
  static const bool value =
  std::is_base_of::value || (std::is_same::value &&
   std::is_convertible::value);
};

template
struct TNode {
  TNode();

  template::value>>
  TNode(const TNode&); // #1

  TNode(const TNode&);// #2
};

std::tuple> node;

The instantiation of std::is_convertible happens when
synthesizing tuple> defaulted move constructor, for which we
need to perform overload resolution of TNode's constructors with a TNode&&
argument, and when considering the template candidate #1 we need to instantiate
its default template argument which entails instantiation of is_convertible.

In GCC 12 is_convertible for an incomplete type would silently return false. 
In GCC 13 the new built-in __is_convertible diagnoses this UB situation as a
hard error.  Clang's __is_convertible behaves like GCC 12's is_convertible it
seems.

One fix is to define a move constructor for TNode, which causes GCC's perfect
candidate optimization (r11-7287-g187d0d5871b1fa) to kick in and avoid
considering the template candidate #1.  Another fix is to use
std::conjunction/disjunction in is_subtype so that the condition properly
short-circuits (is_base_of is true even for incomplete T).

[Bug c++/109281] New: use std::optional results in suboptimal code

2023-03-25 Thread vincenzo.innocente at cern dot ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109281

Bug ID: 109281
   Summary: use std::optional results in suboptimal code
   Product: gcc
   Version: 12.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: vincenzo.innocente at cern dot ch
  Target Milestone: ---

In the following (almost real) code gcc emits suboptimal code if std::optional
is used w/r/t home made one and clang

see https://godbolt.org/z/Pba51Ye7Y


-

code


#include 

// #define USE_OPTIONAL

#ifdef USE_OPTIONAL
struct SubRingCrossings {
  SubRingCrossings(int ci, int ni, float nd) : closestIndex(ci), nextIndex(ni),
nextDistance(nd) {}

  int closestIndex;
  int nextIndex;
  float nextDistance;
};
#else
struct SubRingCrossings {
  SubRingCrossings() : valid(false) {}
  SubRingCrossings(int ci, int ni, float nd) : valid(true), closestIndex(ci),
nextIndex(ni), nextDistance(nd) {}

  bool valid;
  int closestIndex;
  int nextIndex;
  float nextDistance;
};
#endif

bool condition();

#ifdef USE_OPTIONAL
std::optional foo() {
if (condition()) {
return std::nullopt;
}
return SubRingCrossings(1, 2, 3.14);
}
#else
SubRingCrossings foo() {
if (condition()) {
return SubRingCrossings();
}
return SubRingCrossings(1, 2, 3.14);
}
#endif

int bar() {
auto tmp = foo();
#ifdef USE_OPTIONAL
if (tmp) {
return tmp->closestIndex;
#else
if (tmp.valid) {
return tmp.closestIndex;
#endif
} else {
return 0;
}
}