public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
Date: Tue, 30 Jan 2024 12:45:54 +0000	[thread overview]
Message-ID: <bug-113617-4-PjsV4osiMz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113617-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113617

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The huge names make the assembly quite unreadable, so I've tried to reduce it a
little bit further:
pr113617.h:
namespace {
template <int V> struct J { static constexpr int value = V; };
template <bool V> using K = J<V>;
using M = K<true>;
template <int> struct L { template <typename _Tp, typename> using type = _Tp;
};
template <bool _Cond, typename _If, typename _Else> using N = typename
L<_Cond>::type<_If, _Else>;
M k;
template <typename _Tp> struct O { using type = _Tp; };
template <typename _Up>
struct P : N<M ::value, O<_Up>, _Up> {};
template <typename _Tp> struct Q { using type = typename P<_Tp>::type; };
}
namespace R {
struct H;
enum G {};
template <typename> class S;
struct T { using U = bool (*) (H &, const H &, G); U F; };
template <typename, typename> class B;
template <typename _R, typename _F, typename... _A>
struct B<_R(_A...), _F> {
  static bool F(H &, const H &, G) { return false; }
  __attribute__((noipa)) static _R bar(const H &) {}
};
template <typename _R, typename... _A>
struct S<_R(_A...)> : T {
  template <typename _F> using AH = B<_R(), _F>;
  template <typename _F> S(_F) {
    using AG = AH<_F>;
    barr = AG::bar;
    F = AG::F;
  }
  using AF = _R (*)(const H &);
  AF barr;
};
template <typename> class I;
template <typename _F, typename... _B>
struct I<_F(_B...)> {};
template <typename> using W = decltype(k);
template <int, typename _F, typename... _B> struct V {
  typedef I<typename Q<_F>::type(typename Q<_B>::type...)> type;
};
template <typename _F, typename... _B>
__attribute__((noipa)) typename V<W<_F>::value, _F, _B...>::type
baz(_F, _B...) { return typename V<W<_F>::value, _F, _B...>::type (); }
template <typename _Tp> struct AJ {
  template <typename _Up> struct _Ptr { using type = _Up *; };
  using AI = typename _Ptr<_Tp>::type;
};
template <typename _Tp> struct Y {
  using AI = typename AJ<_Tp>::AI;
  AI operator->();
};
}
extern int z;
namespace N1 {
namespace N2 {
namespace N3 {
enum Z { Z1, Z2 };
template <int> struct X {
  template <typename _F>
  __attribute__((noipa)) void boo(long long, long long, long long, _F &) {}
};
struct AC {
  AC(int);
  void m1(R::S<void()>);
};
template <typename>
__attribute__((noipa)) void garply(void *, long long, long long, long long) {}
template <>
template <typename _F>
void X<Z2>::boo(long long, long long x, long long y, _F &fi) {
  AC pool(z);
  for (;;) {
    auto job = R::baz(garply<_F>, &fi, y, y, x);
    pool.m1(job);
  }
}
struct AB {
  static AB &bleh();
  template <typename _F>
  void boo(long first, long x, long y, _F fi) {
    switch (ab1) {
    case Z1:
      ab2->boo(first, x, y, fi);
    case Z2:
      ab3->boo(first, x, y, fi);
    }
  }
  Z ab1;
  R::Y<X<Z1>> ab2;
  R::Y<X<Z2>> ab3;
};
template <typename, bool> struct C;
template <typename _F> struct C<_F, false> {
  __attribute__((noipa)) C(_F) {}
  void boo(long first, long x, long y) {
    auto u = AB::bleh();
    u.boo(first, x, y, *this);
  }
};
template <typename _F> struct AA { typedef C<_F, 0> type; };
}
}
}
struct AD {
  template <typename _F>
  static void boo(long first, long x, long y, _F f) {
    typename N1::N2::N3::AA<_F>::type fi(f);
    fi.boo(first, x, y);
  }
  template <typename _F>
  static void boo(long first, long x, _F f) {
    boo(first, x, 0, f);
  }
};
template <typename> struct A {
  void foo(long long, long long);
  int *c;
};
namespace {
template <typename> struct D { __attribute__((noipa)) D(int *) {} };
}
template <typename T>
void A<T>::foo(long long x, long long y)
{
  int e;
  D<T> d(&e);
  AD::boo(0, y, d);
  long p;
  for (p = 0; p < x; p++)
    c[p] = c[p - 1];
}
pr113617.C:
#include "pr113617.h"
int z;
long xx1;
void corge() {
  A<long long> a;
  a.foo(xx1, 0);
}
pr113617-aux.cc:
#include "pr113617.h"
void qux() {
  A<long long> a;
  a.foo(0, 0);
}

From what I can see, there is just one comdat group, _ZN1AIxE3fooExx, in the
whole testcase, which contains everything instantiated because of the foo
instantiation.

  parent reply	other threads:[~2024-01-30 12:45 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26 13:08 [Bug rtl-optimization/113617] New: " jakub at gcc dot gnu.org
2024-01-26 13:08 ` [Bug rtl-optimization/113617] " jakub at gcc dot gnu.org
2024-01-26 13:09 ` jakub at gcc dot gnu.org
2024-01-26 13:09 ` jakub at gcc dot gnu.org
2024-01-26 13:10 ` jakub at gcc dot gnu.org
2024-01-26 14:22 ` hjl.tools at gmail dot com
2024-01-26 14:28 ` jakub at gcc dot gnu.org
2024-01-26 14:39 ` hjl.tools at gmail dot com
2024-01-26 15:52 ` jakub at gcc dot gnu.org
2024-01-26 15:52 ` jakub at gcc dot gnu.org
2024-01-26 15:52 ` jakub at gcc dot gnu.org
2024-01-26 15:55 ` sjames at gcc dot gnu.org
2024-01-26 16:13 ` jakub at gcc dot gnu.org
2024-01-26 20:44 ` hjl.tools at gmail dot com
2024-01-27  5:53 ` hjl.tools at gmail dot com
2024-01-27 15:13 ` hjl.tools at gmail dot com
2024-01-30 12:45 ` jakub at gcc dot gnu.org [this message]
2024-02-14  3:20 ` orion at nwra dot com
2024-02-14  8:20 ` jakub at gcc dot gnu.org
2024-02-26 17:06 ` cvs-commit at gcc dot gnu.org
2024-02-26 17:25 ` jakub at gcc dot gnu.org
2024-03-07 13:31 ` fxcoudert at gcc dot gnu.org
2024-03-07 14:03 ` jakub at gcc dot gnu.org
2024-03-07 14:07 ` fxcoudert at gcc dot gnu.org
2024-03-07 14:08 ` jakub at gcc dot gnu.org
2024-03-07 14:11 ` fxcoudert at gcc dot gnu.org
2024-03-07 14:13 ` jakub at gcc dot gnu.org
2024-03-07 14:20 ` fxcoudert at gcc dot gnu.org
2024-03-07 14:23 ` fxcoudert at gcc dot gnu.org
2024-03-08 14:19 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113617-4-PjsV4osiMz@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).