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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code

--- Comment #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
This is what creduce finally came up with: 

 % cat test_blast.ii
extern "C" int snprintf(char *, unsigned long, const char *...);
template <typename> struct Value;
template <typename T> struct A { typedef typename Value<T>::Type Type; };
struct B;
template <typename, typename> struct C;
template <typename T> struct C<T, int> {
  typedef typename Value<T>::Type Type;
};
template <typename, typename> struct D;
template <typename TContainer, typename TSpec>
struct Value<D<TContainer, TSpec>> : Value<TContainer> {};
template <typename TContainer, typename TSpec>
typename A<D<TContainer, TSpec>>::Type operator*(D<TContainer, TSpec>);
template <typename TContainer, typename TSpec>
void operator++(D<TContainer, TSpec>);
template <typename, typename = int> struct F;
template <typename TContainer, typename TIterator, typename TSpec>
struct D<TContainer, F<TIterator, TSpec>> {};
template <typename T> struct C<T, B> {
  typedef D<T, F<typename C<T, int>::Type>> Type;
};
template <typename TContainer, typename TIterator, typename TSpec>
int operator!=(D<TContainer, TIterator>, D<TContainer, TSpec>);
struct G {
  char *format;
  G(char *p1) : format(p1) {}
};
template <typename TTarget, typename TIValue, typename TSize>
void write(TTarget, TIValue, TSize);
template <typename TTarget, typename TValue>
void appendNumber(TTarget, TValue p2) {
  char a[0];
  int b = snprintf(a, sizeof(0), p2.format, 0);
  write(0, 0, b);
}
template <typename TTarget, typename TValue> void write(TTarget, TValue p2) {
  appendNumber(0, p2);
}
template <typename _Tp> struct H {
  _Tp operator*();
  void operator++();
  int operator!=(H);
};
template <typename _Tp> struct I {
  typedef H<_Tp> const_iterator;
  const_iterator begin();
  const_iterator end();
};
template <typename T> typename C<T const, B>::Type begin(T);
template <typename T> typename C<T const, B>::Type end(T);
template <typename, typename = int> struct String;
template <typename TValue, typename TSpec> struct Value<String<TValue, TSpec>>
{
  typedef TValue Type;
};
template <typename TValue, typename TSpec>
struct Value<String<TValue, TSpec> const> : Value<String<TValue>> {};
template <typename, typename> struct String {};
enum BlastProgram { DYNAMIC };
template <typename, typename, typename = int, typename = int, typename = int>
struct J {};
struct K {
  I<J<int, int>> matches;
} c;
enum struct BlastTabularSpec { DYNAMIC };
template <typename = int, BlastProgram = DYNAMIC,
          BlastTabularSpec = BlastTabularSpec::DYNAMIC>
struct L {};
template <typename TStream, typename TScoreSpec, typename TMatch,
          BlastProgram p, BlastTabularSpec h>
void _writeStatsBlock(TStream, L<TScoreSpec, p, h>, TMatch) {
  write(0, G(""));
}
template <typename TStream, typename TScore, typename TQId, typename TSId,
          typename TPos, typename TAlignRow0, typename TAlignRow1,
          BlastProgram p, BlastTabularSpec h>
void _writeFullMatch(TStream, L<TScore, p, h> p2,
                     J<TAlignRow0, TAlignRow1, TPos, TQId, TSId>) {
  _writeStatsBlock(0, p2, 0);
}
template <typename TStream, typename TScore, BlastProgram p, BlastTabularSpec
h>
void writeRecord(TStream, L<TScore, p, h> p2) {
  for (auto m : c.matches)
    _writeFullMatch(0, p2, m);
}
void writeRecord(int, K) {
  L<> d;
  writeRecord(0, d);
}
template <typename TFile, typename TScore, typename TRecords, BlastProgram p,
          BlastTabularSpec h>
void _testBlastOutputWriteFile(TFile, L<TScore, p, h>, TRecords p3) {
  for (auto r : p3)
    writeRecord(0, r);
}
template <typename TFile, typename TScore, typename TFormat, BlastProgram p,
          BlastTabularSpec h>
void _testBlastOutputGenerateContent(TFile, L<TScore, p, h> p2, TFormat) {
  String<K> e;
  _testBlastOutputWriteFile(0, p2, e);
}
template <typename TScore, typename TFormat, BlastProgram p, BlastTabularSpec
h>
void _testBlastOutput(L<TScore, p, h> p1, TFormat) {
  _testBlastOutputGenerateContent(0, p1, 0);
}
void foo() try {
  L<> f;
  _testBlastOutput(f, 0);
} catch (int) {
}

 % ~/gcc_test/usr/local/bin/g++ -w -O3 -c test_blast.ii
test_blast.ii: In function ‘void foo()’:
test_blast.ii:105:6: error: statement marked for throw in middle of block
 void foo() try {
      ^~~
# .MEM_26 = VDEF <.MEM_23>
snprintf (&a, 4, "", 0);

Reply via email to