[Bug c++/100083] New: combining `-O3` and `-fPIC` causes "used uninitialized" error

2021-04-14 Thread yichen.yan at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100083

Bug ID: 100083
   Summary: combining `-O3` and `-fPIC` causes "used
uninitialized" error
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: yichen.yan at inf dot ethz.ch
  Target Milestone: ---

g++ reports "used uninitialized" error only with -O3 and -fPIC.

Sorry for the unreadability, This case is reduced by creduce, from some STL
code.

root@amdsuplus1:/test# g++ -Werror=uninitialized -fPIC -o /dev/null -S test.ii
root@amdsuplus1:/test# g++ -Werror=uninitialized -O3 -o /dev/null -S test.ii
root@amdsuplus1:/test# g++ -Werror=uninitialized -O3 -fPIC -o /dev/null -S
test.ii
test.ii: In member function 'void u::v()':
test.ii:24:20: error: '' is used uninitialized in this function
[-Werror=uninitialized]
   int t() { return q(*this).r(); }
^
cc1plus: some warnings being treated as errors
root@amdsuplus1:/test# cat test.ii
// g++ -Werror=uninitialized -O3 -fPIC -o /dev/null -S test.ii

template  struct b { static const int aa = a; };
struct c {
  static b<0> d();
};
template  struct f;
template  struct f : b<0> {};
struct i : f::aa, int> {};
void j(long) {}
class k;
template  class l;
struct n {
  typedef b<0> m;
};
template  struct q {
  int r() { return ah; }
  int ah;
  q(int) {}
};
class s : q, q {
public:
  template  s(an, ao) : q(0), q(ao()) {}
  int t() { return q(*this).r(); }
};
template  class ar {
public:
  s at;
  ar() noexcept(i::aa);
  ~ar();
};
template  ar::ar() noexcept(i::aa) : at(nullptr, int()) {}
template  ar::~ar() {
  long o = at.t();
  j(o);
}
template  class l : ar {
public:
  l() {}
  l =(l &&) noexcept(b::aa);
};
template 
l ::operator=(l &&) noexcept(b::aa) {
  return *this;
}
struct H {
  l p;
};
class u {
  void v();
  H au;
};
void u::v() { au = {}; }

[Bug libstdc++/91558] [C++11] should not be constexpr until C++14

2019-08-27 Thread yichen.yan at inf dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91558

--- Comment #3 from Yichen Yan  ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to Yichen Yan from comment #0)
> > Detail: 
> > Constexpr for  is in C++14 if I don't misunderstand. But a lot of
> > testcases under libstdc++-v3/testsuite/26_numerics/complex/ (e.g. dr844.cc)
> 
> Are you sure? That test doesn't seem to care about constexpr.

Yes, check_ret_type require its template argument and argument to be constexpr.

> > runs with C++11 and check for constexpr (and pass).
> > 
> > I haven't found some manual or doc explaining that, and wonder if this is a
> > bug or some feature?
> 
> The mailing lists are a better place to ask a question like that.
> 
> Adding constexpr to std::complex was done by r166171 many years ago. I think
> at the time implementations were allowed to add constexpr as a conforming
> extension. I don't see a compelling reason to change it now.

I see. Thanks for your reply.

[Bug libstdc++/91558] New: [C++11] should not be constexpr until C++14

2019-08-27 Thread yichen.yan at inf dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91558

Bug ID: 91558
   Summary: [C++11]  should not be constexpr until C++14
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: yichen.yan at inf dot ethz.ch
  Target Milestone: ---

Detail: 
Constexpr for  is in C++14 if I don't misunderstand. But a lot of
testcases under libstdc++-v3/testsuite/26_numerics/complex/ (e.g. dr844.cc)
runs with C++11 and check for constexpr (and pass).

I haven't found some manual or doc explaining that, and wonder if this is a bug
or some feature?