Regression/bug in 4.7 regarding typedef in templated class

2012-10-27 Thread Peter A. Felvegi
Hello, after upgrading gcc one of my classes failed to compile. Stock Debian/Wheezy 4.4, 4.5, 4.6 compiled the code, also compiled a version of 4.7.0 that was built by me from sources some time ago. Clang 3.0-6 also compiled, but stock 4.7.1-7, the head of 4.7 (4.7.3 d51dc77f, r192839) and th

Re: Regression: incorrect line numbers in debug info since 4.5+

2012-06-25 Thread Peter A. Felvegi
The bug is at: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53770 Regards, Peter

Re: Regression: incorrect line numbers in debug info since 4.5+

2012-06-25 Thread Peter A. Felvegi
Hello, Which version of GDB? As documented at http://gcc.gnu.org/gcc-4.5/changes.html GCC now generates unwind info also for epilogues. DWARF debuginfo generated by GCC now uses more features of DWARF3 than before, and also some DWARF4 features. GDB older than 7.0 is not able to handle either o

Regression: incorrect line numbers in debug info since 4.5+

2012-06-25 Thread Peter A. Felvegi
Hello, I found out while single stepping a new template function in gdb that gcc generates bad/inaccurate line numbers in the debug info. Optimization was turned off, but the execution jumped strangely, see below. gcc-4.4 and the current clang produced the expected results, gcc 4.5, 4.6, 4.7,

Re: Code optimization: warning for code that hangs

2012-06-25 Thread Peter A. Felvegi
Hello, So far so good, but J::F() is strange: Dump of assembler code for function J::F(): 0x00400498 <+0>:subrsp,0x8 0x0040049c <+4>:movrax,QWORD PTR [rdi] 0x0040049f <+7>:movrax,QWORD PTR [rax] 0x004004a2 <+10>:movrax

Code optimization: warning for code that hangs

2012-06-23 Thread Peter A. Felvegi
Hello, I bumped into a strange bug today: the program hang at a point, inspecting the disassembly revealed that it was a single jmp instruction which jumped onto itself. Most of the code from the C++ function was missing. The bug occurs at -O2 or -O3, -O1 generates correct code. The function

error: call of overloaded ‘foo(int)’ is ambiguous (0 vs null ptr)

2012-05-24 Thread Peter A. Felvegi
Hello, I'm not sure whether this is standard behaviour or not; nonetheless I was quite surprised: 8<8<8< void foo(long); void foo(const char*); void bar() { foo(0); foo(0+0); // ! foo(1-1); // ! foo(1); } 8<8<8< The first call t

Insufficient access check for private static member in base class

2012-05-18 Thread Peter A. Felvegi
Hello, I've bumped into the following: 8<8<8<8< class Base { static int foo; }; #if 0 class Deriv : public Base { public: int Foo() { return foo; } }; #endif template class DerivT : public Base { public: int Foo() { return foo; } }; void bar() { DerivT dt; dt.Foo(); }

Re: Failed access check

2012-04-26 Thread Peter A. Felvegi
On 04/23/2012 08:20 PM, Jonathan Wakely wrote: On 23 April 2012 18:48, Ian Lance Taylor wrote: "Peter A. Felvegi" writes: Should I file a bug report? Yes, please. Thanks. Please check it's not http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24926 first Hello, it seems to be

Failed access check

2012-04-23 Thread Peter A. Felvegi
Hello, clang gave an error on a code that compiled with gcc so far. The reduced test case is: 8<8<8<8<--- class V; struct E { E(const V& v_); char* c; V* v; int i; }; class V { private: union { char* c; struct { V* v; int i; }; }; }; E::E(const V& v_) : c(v_.c), // line 25

Misleading error message with templated c++ code

2012-02-03 Thread Peter A. Felvegi
Hello, compiling the following: ---8<---8<---8<---8<--- template struct Base { typename T::Typevar; }; template struct Derived : Base > { typedef U Type; }; void foo() { Derived i; } ---8<---8<---8<---8<--- gives the error gcctempl.cpp: In instantiation of ‘

multiple destructor calls of static objects

2012-01-24 Thread Peter A. Felvegi
Hello, I ran into a bug with 4.6, when implementing a custom rtti framework, on an Amd64 Debian Wheezy box. It seems that at certain optimization levels, dtors of static objects are called multiple times. Attached a test case. It will print 'DEADBEEF' when the bug is hit. Searched bugzilla fo

Missed optimization opportunity

2012-01-09 Thread Peter A. Felvegi
Hello, I've come across an issue when working on a smart pointer implementation. Gcc does not seem to propagate constants enough, missing some optimization opportunities. I don't think that this issue is specific to smart pointers, so there might be other cases when gcc generates suboptimal c

Re: Misleading error if the type in catch() is ambiguous

2012-01-04 Thread Peter A. Felvegi
Hello, I pinpointed the commit that introduced the bug, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51640 Regards, Peter

Re: Misleading error if the type in catch() is ambiguous

2011-12-20 Thread Peter A. Felvegi
I've submitted a bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51640 Regards, Peter

Misleading error if the type in catch() is ambiguous

2011-12-20 Thread Peter A. Felvegi
Dear All, I suspect there is a regression from g++ 4.4 in later versions. If the name of the class is ambiguous in a catch(), this fact is not reported. I had checked bz, but not found this particular case: http://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=ambiguous Attached a simple test c

array subscript is below array bounds : false positive?

2009-09-15 Thread Peter A. Felvegi
Hello, I've run into this strange warning when compiling w/ optimization: gcc-4.3 -O2 -Werror -Wall -c -o t.o t.c cc1: warnings being treated as errors t.c: In function ‘foo’: t.c:25: error: array subscript is below array bounds gcc-4.4 gives the same warning/error, however, gcc 4.1 and 4.2 comp

Possible optimizer bug?

2008-10-27 Thread Peter A. Felvegi
Hello all, I've run today into an infinite loop when compiled a test suite w/ optimizations. The original tests were to do some loops with all the nonnegative values of some integral types. Instead of hardwiring the max values, I thought testing for overflow into the negative domain is ok.

Compiler error w/ templates and default argument value

2008-10-10 Thread Peter A. Felvegi
Hello All, I've run into this: 8<8<8< template class B { protected: static const int i = 42; }; template class D : protected B { public: D(int n_ = B::i); // line 12 }; 8<8<8< gcc-4.1 and 4.3 give the same error message: t.cpp:12: error: expecte

va_list bug?

2008-03-18 Thread Peter A. Felvegi
hello, please try the little program at the end. my naive assumption was that it will print "hello world" two times. if compiled with gcc 3.4, 4.1, 4.2 or 4.3 for i386, it will print "hello world" two times all right. however, if compiled with 3.3, 3.4, 4.1 or 4.3 for amd64, the second time it w

Copy constructor access check while initializing a reference

2008-03-03 Thread Peter A. Felvegi
hello, i've found this in the known non-bugs list (http://gcc.gnu.org/bugs.html#known), after running into the issue. gcc 3.4-4.2 gives a compile error, but 4.3 compiles it. is this a regression, or the rules were relaxed somewhat (c++0x?) ? i checked the changelog, but couldn't find any relevant

ctor style cast vs c style cast

2007-12-13 Thread Peter A. Felvegi
hello all, today i've run into this: if i cast a double value to an unsigned int using the C style cast when passing it to printf, it's fine. however, if i use the ctor style cast, i get a compile error. in theory, these two should do the same: create a temporary unsigned int, and assign the doubl

Re: function overloading and variadic arguments

2007-09-21 Thread Peter A. Felvegi
>> i'd like to hear your comments. > > Is va_list a typedef for char* on your system, then? What ever happened to > it being an alias for __builtin_va_list via __gnuc_va_list? i don't know what happened, but it seems like a char*. my system is a debian i636 etch, here are compiler versions: $

function overloading and variadic arguments

2007-09-20 Thread Peter A. Felvegi
hello, today i've spent a few hours debugging... consider the following code: >8>8>8>8>8>8 // test.cpp #include #include int prn(const char* fmt_); int prn(const char* fmt_, ...) __attribute__((format(printf, 1, 2))); int prn(const char* fmt_, va_list args_); int p

can't reinterpret_cast to/from the same type

2007-09-06 Thread Peter A. Felvegi
hello, i don't know if it's a bug, please clarify: rc.cpp: --8<-- void f() { int x = 0; int y = reinterpret_cast(x); } --8<-- gcc -v: Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,tre