[Bug c++/57086] New: Internal compiler error: Error reporting routines re-entered.

2013-04-26 Thread madars+gccbug at gmail dot com

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57086

 Bug #: 57086
   Summary: Internal compiler error: Error reporting routines
re-entered.
Classification: Unclassified
   Product: gcc
   Version: 4.7.3
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: madars+gcc...@gmail.com


The code is obviously wrong, but it shouldn't give ICE.

$ g++ --version | head -1
g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3

$ g++ -std=c++11 crash.cpp 
crash.cpp:15:35: error: ‘undef_class’ was not declared in this scope
crash.cpp:15:46: error: template argument 1 is invalid
crash.cpp: In member function ‘void p::f2(int)’:
crash.cpp:17:23: error: no matching function for call to ‘begin(int&)’
crash.cpp:17:23: note: candidates are:
In file included from /usr/include/c++/4.7/vector:67:0,
 from crash.cpp:1:
/usr/include/c++/4.7/bits/range_access.h:87:5: note: template _Tp* std::begin(_Tp (&)[_Nm])
/usr/include/c++/4.7/bits/range_access.h:87:5: note:   template argument
deduction/substitution failed:
crash.cpp:17:23: note:   mismatched types ‘_Tp [_Nm]’ and ‘int’
In file included from /usr/include/c++/4.7/vector:67:0,
 from crash.cpp:1:
/usr/include/c++/4.7/bits/range_access.h:58:5: note: template
decltype (__cont.begin()) std::begin(const _Container&)
/usr/include/c++/4.7/bits/range_access.h:58:5: note:   template argument
deduction/substitution failed:
/usr/include/c++/4.7/bits/range_access.h: In substitution of ‘template decltype (__cont.begin()) std::begin(const _Container&) [with
_Container = int]’:
crash.cpp:17:23:   required from here
/usr/include/c++/4.7/bits/range_access.h:58:5: error: request for member
‘begin’ in ‘__cont’, which is of non-class type ‘const int’
/usr/include/c++/4.7/bits/range_access.h:48:5: note: template
decltype (__cont.begin()) std::begin(_Container&)
/usr/include/c++/4.7/bits/range_access.h:48:5: note:   template argument
deduction/substitution failed:
/usr/include/c++/4.7/bits/range_access.h: In substitution of ‘template decltype (__cont.begin()) std::begin(_Container&) [with _Container
= int]’:
crash.cpp:17:23:   required from here
/usr/include/c++/4.7/bits/range_access.h:48:5: error: request for member
‘begin’ in ‘__cont’, which is of non-class type ‘int’
In file included from /usr/include/c++/4.7/bits/stl_vector.h:64:0,
 from /usr/include/c++/4.7/vector:65,
 from crash.cpp:1:
/usr/include/c++/4.7/initializer_list:89:5: note: template constexpr
const _Tp* std::begin(std::initializer_list<_Tp>)
/usr/include/c++/4.7/initializer_list:89:5: note:   template argument
deduction/substitution failed:
crash.cpp:17:23: note:   mismatched types ‘std::initializer_list<_Tp>’ and
‘int’
crash.cpp:17:23: error: no matching function for call to ‘end(int&)’
crash.cpp:17:23: note: candidates are:
In file included from /usr/include/c++/4.7/vector:67:0,
 from crash.cpp:1:
/usr/include/c++/4.7/bits/range_access.h:97:5: note: template _Tp* std::end(_Tp (&)[_Nm])
/usr/include/c++/4.7/bits/range_access.h:97:5: note:   template argument
deduction/substitution failed:
crash.cpp:17:23: note:   mismatched types ‘_Tp [_Nm]’ and ‘int’
In file included from /usr/include/c++/4.7/vector:67:0,
 from crash.cpp:1:
/usr/include/c++/4.7/bits/range_access.h:78:5: note: template
decltype (__cont.end()) std::end(const _Container&)
/usr/include/c++/4.7/bits/range_access.h:78:5: note:   template argument
deduction/substitution failed:
/usr/include/c++/4.7/bits/range_access.h: In substitution of ‘template decltype (__cont.end()) std::end(const _Container&) [with
_Container = int]’:
crash.cpp:17:23:   required from here
/usr/include/c++/4.7/bits/range_access.h:78:5: error: request for member ‘end’
in ‘__cont’, which is of non-class type ‘const int’
/usr/include/c++/4.7/bits/range_access.h:68:5: note: template
decltype (__cont.end()) std::end(_Container&)
/usr/include/c++/4.7/bits/range_access.h:68:5: note:   template argument
deduction/substitution failed:
/usr/include/c++/4.7/bits/range_access.h: In substitution of ‘template decltype (__cont.end()) std::end(_Container&) [with _Container =
int]’:
crash.cpp:17:23:   required from here
/usr/include/c++/4.7/bits/range_access.h:68:5: error: request for member ‘end’
in ‘__cont’, which is of non-class type ‘int’
In file included from /usr/include/c++/4.7/bits/stl_vector.h:64:0,
 from /usr/include/c++/4.7/vector:65,
 from crash.cpp:1:
/usr/include/c++/4.7/initializer_list:99:5: note: template constexpr
const _Tp* std::end(std::initializer_list<_Tp>)
/usr/include/c++/4.7/initializer_list:99:5: note:   template argument
deduction/substitution failed:
crash.cpp:17:23: note:   mismatched types ‘std::initializer_list<_Tp>’ and
‘int’
crash.cpp:17:23: error: unable to deduce ‘auto’ from ‘’
In file included fro

[Bug c++/57086] Internal compiler error: Error reporting routines re-entered.

2013-04-26 Thread madars+gccbug at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57086



--- Comment #1 from madars+gccbug at gmail dot com 2013-04-26 20:48:24 UTC ---

Created attachment 29949

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29949

triggering code


[Bug c++/57086] Internal compiler error: Error reporting routines re-entered.

2013-04-26 Thread madars+gccbug at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57086



--- Comment #2 from madars+gccbug at gmail dot com 2013-04-26 21:20:45 UTC ---

Created attachment 29951

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29951

pre-processed source file


[Bug c/65307] New: Incorrect optimization breaks basic arithmetic

2015-03-04 Thread madars+gccbug at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65307

Bug ID: 65307
   Summary: Incorrect optimization breaks basic arithmetic
   Product: gcc
   Version: 4.9.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: madars+gccbug at gmail dot com

The following code sample exhibits a bug in a gcc -O2 optimization pass.
Namely, having defined two() and six() with the obvious return values, the
value of two() * 2 + six() * 5 gets an assembly of 1 shl 5 (i.e. 32, instead of
the correct 34).

Code: http://web.mit.edu/madars/Public/gcc-basic-arithmetic-bug.c

gcc 4.9.1 and 4.9.2 with -O2 are both buggy, -O1 makes the bug go away; the bug
does not seem to be present in gcc 4.8 and earlier.


[Bug c/65307] Incorrect optimization breaks basic arithmetic

2015-03-04 Thread madars+gccbug at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65307

--- Comment #1 from madars+gccbug at gmail dot com ---
I should clarify that the same behavior can be observed on Debian, Ubuntu and
Fedora:

gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.1
gcc (Debian 4.9.1-19) 4.9.1
gcc (GCC) 4.9.2 20141101 (Red Hat 4.9.2-1)

Moreover, Alex Chernyakhovsky reports that switching two() * 2 to two() + two()
or two() << 1 produces correct results, so this seems to have to do with the
handling of multiplication.


[Bug tree-optimization/65307] [4.9 Regression] Incorrect optimization breaks basic arithmetic

2015-03-04 Thread madars+gccbug at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65307

--- Comment #12 from madars+gccbug at gmail dot com ---
By the way, in g++ the bug can be triggered even with -O1 and without marking
any functions inline (implicitly or explicitly):

http://web.mit.edu/madars/Public/gcc-basic-arithmetic-bug-O1.cpp