[Bug c++/53602] [4.7/4.8 Regression] Libre Office causes an internal compiler error

2012-06-09 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53602

--- Comment #10 from Richard Henderson rth at gcc dot gnu.org 2012-06-09 
06:14:34 UTC ---
Author: rth
Date: Sat Jun  9 06:14:27 2012
New Revision: 188356

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=188356
Log:
PR c++/53602
* combine-stack-adj.c (force_move_args_size_note): Add ARGS_SIZE
note to a clobber insn when no other insn is available.

Added:
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/torture/pr53602.C
Modified:
branches/gcc-4_7-branch/gcc/ChangeLog
branches/gcc-4_7-branch/gcc/combine-stack-adj.c


[Bug c++/53602] [4.7/4.8 Regression] Libre Office causes an internal compiler error

2012-06-09 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53602

--- Comment #11 from Richard Henderson rth at gcc dot gnu.org 2012-06-09 
06:17:27 UTC ---
Author: rth
Date: Sat Jun  9 06:17:12 2012
New Revision: 188357

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=188357
Log:
PR c++/53602
* combine-stack-adj.c (force_move_args_size_note): Add ARGS_SIZE
note to a clobber insn when no other insn is available.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/combine-stack-adj.c


[Bug c++/53602] [4.7/4.8 Regression] Libre Office causes an internal compiler error

2012-06-09 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53602

--- Comment #12 from Richard Henderson rth at gcc dot gnu.org 2012-06-09 
06:18:53 UTC ---
Author: rth
Date: Sat Jun  9 06:18:38 2012
New Revision: 188358

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=188358
Log:
PR c++/53602

Added:
trunk/gcc/testsuite/g++.dg/torture/pr53602.C


[Bug fortran/52531] [OOP] Compilation fails with polymorphic dummy argument and OpenMP

2012-06-09 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52531

--- Comment #5 from janus at gcc dot gnu.org 2012-06-09 09:34:53 UTC ---
Note: Apart from the two workarounds mentioned in the test case, there is one
other possibility to make it work, namely to make 'bar' also polymorphic (like
the dummy 'var'), e.g.:

class(test_type), allocatable :: bar


[Bug c++/53611] class with hidden visibility cause function returns pointer to class also be hidden

2012-06-09 Thread kirbyz...@sogou-inc.com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53611

--- Comment #3 from Kirby Zhou kirbyz...@sogou-inc.com 2012-06-09 09:43:09 
UTC ---
If myopen returns __cook, I will agree with you. But myopen returns
__cook *, just a pointer.
I do not think it is reasonable to hide myopen.
It is a usual method to hide the implementation detail of cook_t, but exports 
some free function to operate with cook_t*, such as FILE *.


(In reply to comment #2)
 I think this is expected behavior as if someone defines a __cook in the
 executable which links to the shared library, it will be considered a 
 different
 type.


[Bug libstdc++/53270] Error when bootstrapping gcc on hppa2.0-unknown-linux-gcc

2012-06-09 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53270

Jonathan Wakely redi at gcc dot gnu.org changed:

   What|Removed |Added

   Target Milestone|--- |4.6.4


[Bug c++/53619] New: [c++11, regression] wrong capture of this in lambda in case of polymorphism

2012-06-09 Thread vincenzo.innocente at cern dot ch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53619

 Bug #: 53619
   Summary: [c++11, regression] wrong capture of this in lambda
in case of polymorphism
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: vincenzo.innoce...@cern.ch


in this example x is wrongly captured
./a.out 
in foo 1
in lambda 4203472
Segmentation fault (core dumped)

removing the inheritance from B works as expected

It starts at the same time I had to capture this explicitly…
(sorry, only now had the time to debug it fully and reduce it some how)

#includeiostream
struct CA {
  const int x;
  constexpr CA(int i) : x(i){}
};
struct B {
  virtual ~B(){}
};

struct A : public B, private CA {
  A(CA const c) : CA(c){}
  int foo(int *, int);
};


int A::foo(int * h, int l) {
  std::cout  in foo   x  std::endl;
  int a=0;
  auto k = [a, h ,this](int i) {
std::cout  in lambda   x  std::endl;
a+=h[x+i];
  };
  for (int i=0; i!=l; ++i)
 k(i);
  return a;
}



int main(int l, char **) {
  CA ca(1);
  A a(ca);
  int h[l+2]; h[0]=l;
  std::cout  a.foo(h,l)  std::endl;
}


[Bug c++/53619] [c++11, regression] wrong capture of this in lambda in case of polymorphism

2012-06-09 Thread vincenzo.innocente at cern dot ch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53619

--- Comment #1 from vincenzo Innocente vincenzo.innocente at cern dot ch 
2012-06-09 16:16:32 UTC ---
reduced a bit showing how the offset is wrongly computed

struct CA {
  int x;
};
struct B {
  virtual ~B(){}
};

struct A : public B , CA  {
  int foo(int);
};


int A::foo(int l) {
  std::cout  in foo   x (void *)(x)  std::endl;
  auto k = [this](int i) {
std::cout  in lambda   x (void *)(x)  std::endl;
return x+i;
  };
  return k(l); 
}



int main(int l, char **) {
  A a; a.x=1;
  std::cout  a.foo(l)  std::endl;
}

 c++ -O2 -std=gnu++11 lambda_this2.cpp
 ./a.out 
in foo 1 0x7fff6c4de178
in lambda 4198320 0x7fff6c4de170
4198321


[Bug c++/53602] [4.7/4.8 Regression] Libre Office causes an internal compiler error

2012-06-09 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53602

--- Comment #13 from Richard Henderson rth at gcc dot gnu.org 2012-06-09 
16:27:59 UTC ---
Author: rth
Date: Sat Jun  9 16:27:52 2012
New Revision: 188360

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=188360
Log:
PR c++/53602
* cfgcleanup.c (execute_jump): Rename from rest_of_handle_jump2.
(pass_jump): Rename from pass_jump2.
(execute_jump2, pass_jump2): New.
* combine-stack-adj.c (rest_of_handle_stack_adjustments): Don't
perform cfg cleanup here.  Move the test of PUSH_ROUNDING
and ACCUMULATE_OUTGOING_ARGS test...
(gate_handle_stack_adjustments): ... here.
* passes.c (init_optimization_passes): Update for pass_jump2 rename.
Place new pass_jump2 after pass_stack_adjustments.
* tree-pass.h (pass_jump): Declare.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/cfgcleanup.c
trunk/gcc/combine-stack-adj.c
trunk/gcc/passes.c
trunk/gcc/tree-pass.h


[Bug c++/53570] Unused symbols are not removed for fully static targets (avr-gcc)

2012-06-09 Thread ebotcazou at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53570

Eric Botcazou ebotcazou at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||ebotcazou at gcc dot
   ||gnu.org
 Resolution||WORKSFORME

--- Comment #4 from Eric Botcazou ebotcazou at gcc dot gnu.org 2012-06-09 
16:49:59 UTC ---
 Btw: I think that's expected is in the eye of the beholder. If all you've
 ever done is VAX/GCC-style UNIX, then it's expected. If you've worked with
 other toolchains, like AIX, CodeWarrior, Microsoft, etc, then you'd actually
 expect function-level linking by default.

Not sure what VAX/GCC-style UNIX means... it's the default ELF behavior.  And
what you call function-level linking is achieved by means of
-ffunction-sections -fdata-sections -Wl,--gc-sections.  -flto is something
else.


[Bug c++/53619] [c++11, regression] wrong capture of this in lambda in case of multiple inheritance

2012-06-09 Thread vincenzo.innocente at cern dot ch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53619

--- Comment #2 from vincenzo Innocente vincenzo.innocente at cern dot ch 
2012-06-09 17:04:10 UTC ---
an even simpler test

 cat lambda_this2.cpp 
#includecassert
struct C {
  int x;
};
struct B {
  int q;
};
struct A : public B , C  {
  void foo();
};

void A::foo() {
  auto k = [this]() {return (void *)(x);};
  assert(k()==(void *)(x)); 
}

int main(int l, char **) {
  A a; a.foo();
}

c++ -std=gnu++11 lambda_this2.cpp; ./a.out
a.out: lambda_this2.cpp:14: void A::foo(): Assertion `k()==(void *)(x)'
failed.
Aborted (core dumped)


[Bug c++/53620] New: Compiler segfaults when compiling Digikam

2012-06-09 Thread rohangarg at ubuntu dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53620

 Bug #: 53620
   Summary: Compiler segfaults when compiling Digikam
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: rohang...@ubuntu.com


Hi
gcc-4.7 seems to segfault when compiling digikam ( A KDE Photo management app
).
Relevant information as requested :

Output of gcc -v : 

Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.7.0-12ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.0 (Ubuntu/Linaro 4.7.0-12ubuntu1) 

Partial build log :

[ 28%] Building CXX object
extra/kipi-plugins/panorama/CMakeFiles/libpanorama.dir/ptoparser/ptoparser.cpp.o
cd /tmp/buildd/digikam-2.6.0/obj-x86_64-linux-gnu/extra/kipi-plugins/panorama
 /usr/lib/ccache/c++   -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_BSD_SOURCE
-DQT_NO_STL -DQT_NO_CAST_TO_ASCII -D_REENTRANT -DKDE_DEPRECATED_WARNINGS
-DKDE4_CMAKE_TOPLEVEL_DIR_LENGTH=11 -DKDE_DEFAULT_DEBUG_AREA=51000
-DAREA_CODE_GENERAL=51000 -DAREA_CODE_LOADING=51001 -DQT_USE_FAST_CONCATENATION
-DQT_USE_FAST_OPERATOR_PLUS -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef
-Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security
-fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new -fno-common
-Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden
-Werror=return-type -fvisibility-inlines-hidden -DNDEBUG -DQT_NO_DEBUG
-I/tmp/buildd/digikam-2.6.0/obj-x86_64-linux-gnu/extra/kipi-plugins/panorama
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/panorama
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/common/libkipiplugins
-I/tmp/buildd/digikam-2.6.0/obj-x86_64-linux-gnu/extra/kipi-plugins/common/libkipiplugins
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/common/libkipiplugins/dialogs
-I/tmp/buildd/digikam-2.6.0/obj-x86_64-linux-gnu/extra/kipi-plugins/common/libkipiplugins/dialogs
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/common/libkipiplugins/widgets
-I/tmp/buildd/digikam-2.6.0/obj-x86_64-linux-gnu/extra/kipi-plugins/common/libkipiplugins/widgets
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/common/libkipiplugins/tools
-I/tmp/buildd/digikam-2.6.0/obj-x86_64-linux-gnu/extra/kipi-plugins/common/libkipiplugins/tools
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/common/libkipiplugins/tools/threads
-I/tmp/buildd/digikam-2.6.0/obj-x86_64-linux-gnu/extra/kipi-plugins/common/libkipiplugins/tools/threads
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/common/libkipiplugins/tools/imageio
-I/tmp/buildd/digikam-2.6.0/obj-x86_64-linux-gnu/extra/kipi-plugins/common/libkipiplugins/tools/imageio
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/panorama/importwizard
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/panorama/manager
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/panorama/plugin
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/panorama/ptoparser
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/panorama/ptotype
-I/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/panorama/tasks
-I/usr/include/opencv -I/usr/include/KDE -I/usr/include/qt4/phonon
-I/usr/include/qt4/QtXmlPatterns -I/usr/include/qt4/QtXml
-I/usr/include/qt4/QtWebKit -I/usr/include/qt4/QtUiTools
-I/usr/include/qt4/QtTest -I/usr/include/qt4/QtSvg -I/usr/include/qt4/QtSql
-I/usr/include/qt4/QtScriptTools -I/usr/include/qt4/QtScript
-I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtNetwork
-I/usr/include/qt4/QtHelp -I/usr/include/qt4/QtDesigner
-I/usr/include/qt4/QtDeclarative -I/usr/include/qt4/QtDBus
-I/usr/include/qt4/Qt3Support -I/usr/include/qt4/QtGui
-I/usr/include/qt4/QtCore -I/usr/include/qt4/Qt
-I/usr/share/qt4/mkspecs/default -I/usr/include/qt4 -I/usr/include/boost   
-D_GNU_SOURCE -D_LARGEFILE64_SOURCE -fexceptions -UQT_NO_EXCEPTIONS -fPIC -o
CMakeFiles/libpanorama.dir/ptoparser/ptoparser.cpp.o -c
/tmp/buildd/digikam-2.6.0/extra/kipi-plugins/panorama/ptoparser/ptoparser.cpp
In file included from
/usr/include/boost/spirit/home/qi/detail/parse_auto.hpp:14:0,
 from /usr/include/boost/spirit/home/qi/auto.hpp:16,
 from 

[Bug c++/53620] Compiler segfaults when compiling Digikam

2012-06-09 Thread rohangarg at ubuntu dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53620

--- Comment #1 from Rohan Garg rohangarg at ubuntu dot com 2012-06-09 
18:59:47 UTC ---
Seems like my files are too large to be attached, hence you can find them here
http://people.ubuntu.com/~rohangarg/gcc/


[Bug tree-optimization/51938] missed optimization: 2 comparisons

2012-06-09 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51938

Marc Glisse glisse at gcc dot gnu.org changed:

   What|Removed |Added

  Attachment #27591|0   |1
is obsolete||

--- Comment #8 from Marc Glisse glisse at gcc dot gnu.org 2012-06-09 21:36:04 
UTC ---
Created attachment 27592
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27592
patch

Still needs testcases before it can be submitted.


[Bug rtl-optimization/32629] missing CSE for constant in registers / inefficient memset

2012-06-09 Thread hubicka at ucw dot cz
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32629

--- Comment #2 from Jan Hubicka hubicka at ucw dot cz 2012-06-09 22:17:07 UTC 
---
 I suppose doing the $0x0 optimization should be done post-reload.
I was wondering how to implement this nice for some years already I don't
see how this can be done without specialized pass, really, and the interface is
probably going to be bit weird, since it is very weird property of x86
instruction set that there are no stores with short immediate...

Honza


[Bug c++/53619] [c++11, regression] wrong capture of this in lambda in case of multiple inheritance

2012-06-09 Thread hjl.tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53619

H.J. Lu hjl.tools at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2012-06-09
 CC||jason at gcc dot gnu.org
 Ever Confirmed|0   |1

--- Comment #3 from H.J. Lu hjl.tools at gmail dot com 2012-06-09 22:36:39 
UTC ---
It is caused by revision 185768:

http://gcc.gnu.org/ml/gcc-cvs/2012-03/msg01099.html


[Bug fortran/40850] double free in nested types with allocatable components

2012-06-09 Thread b.w.barker at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40850

--- Comment #18 from Brent W. Barker b.w.barker at gmail dot com 2012-06-09 
22:48:47 UTC ---
  I found that the following nested deallocation program still fails in 
  4.6.3.
 
 I can confirm that it fails with 4.6.3. However, it works for me with 4.7.0 
 and
4.8 trunk.

I confirm that it works for me with GNU Fortran (Ubuntu/Linaro 4.7.0-7ubuntu3)
4.7.0


[Bug target/53621] New: [SH] Frame pointers not generated with -fno-omit-frame-pointer on GCC 4.7.0

2012-06-09 Thread bluecrab2887 at netscape dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53621

 Bug #: 53621
   Summary: [SH] Frame pointers not generated with
-fno-omit-frame-pointer on GCC 4.7.0
Classification: Unclassified
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: bluecrab2...@netscape.net


With GCC 4.7.0, frame pointers do not seem to be generated when compiling with
-fno-omit-frame-pointer in a sh-elf targeted GCC.

Compiling the following piece of code generates the same assembly, regardless
of whether -fomit-frame-pointer or -fno-omit-frame-pointer is given:


__attribute__((noinline)) int sum3(int x, int y, int z) {
return x + y + z;
}

int main(int argc, char *argv[]) {
return sum3(1, 2, 3);
}


The code generated is as follows with GCC 4.7.0:

.filetest13.c
.text
.little
.section.text.sum3,ax,@progbits
.align 1
.align 5
.global_sum3
.type_sum3, @function
_sum3:
movr4,r0
addr5,r0
rts
addr6,r0
.size_sum3, .-_sum3
.section.text.startup.main,ax,@progbits
.align 1
.align 5
.global_main
.type_main, @function
_main:
mov.l.L3,r0
mov#1,r4
mov#2,r5
jmp@r0
mov#3,r6
.L4:
.align 2
.L3:
.long_sum3
.size_main, .-_main
.identGCC: (GNU) 4.7.0


With GCC 4.5.2, essentially identical code is generated for when using
-fomit-frame-pointer. However, with -fno-omit-frame-pointer, frame pointers are
generated as expected:

.filetestcase.c
.text
.little
.text
.align 1
.align 5
.global_sum3
.type_sum3, @function
_sum3:
movr5,r0
addr4,r0
mov.lr14,@-r15
addr6,r0
movr15,r14
movr14,r15
rts
mov.l@r15+,r14
.size_sum3, .-_sum3
.align 1
.align 5
.global_main
.type_main, @function
_main:
mov.l.L3,r0
mov#1,r4
mov.lr14,@-r15
mov#2,r5
mov#3,r6
movr15,r14
movr14,r15
jmp@r0
mov.l@r15+,r14
.L4:
.align 2
.L3:
.long_sum3
.size_main, .-_main
.identGCC: (GNU) 4.5.2


[Bug libstdc++/53622] New: C++11 regex captures extra characters

2012-06-09 Thread whatmannerofburgeristhis at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53622

 Bug #: 53622
   Summary: C++11 regex captures extra characters
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: whatmannerofburgerist...@gmail.com


Created attachment 27593
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27593
Test case

Trying to use std::ragex_match captures extra characters that it shouldn't.

Example: 
zxcv/(one.*)abc matching zxcv/onetwoabc

This captures the / as well as the trailing abc.

Tested with MacPorts gcc 4.7 and 4.8 from 20120603


[Bug libstdc++/53622] C++11 regex captures extra characters

2012-06-09 Thread whatmannerofburgeristhis at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53622

--- Comment #1 from Matt Arsenault whatmannerofburgeristhis at gmail dot com 
2012-06-10 02:02:42 UTC ---
The same samples work with boost regex


[Bug target/53621] [SH] Frame pointers not generated with -fno-omit-frame-pointer on GCC 4.7.0

2012-06-09 Thread lsebald1 at umbc dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53621

--- Comment #1 from Lawrence Sebald lsebald1 at umbc dot edu 2012-06-10 
02:29:40 UTC ---
Created attachment 27594
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27594
Remove line forcing -fomit-frame-pointer on sh-elf.

The problem seems to boil down to line 750 of gcc/config/sh/sh.c (in
sh_option_override), which sets flag_omit_frame_pointer to non-zero if the
preferred debugging format is dwarf2 (which it is on sh-elf). It doesn't seem
that any other targets (that I noticed) do anything similar, so it does seem a
bit out of place to do so.

Removing that line (as the attached patch does) makes it so that
-fno-omit-frame-pointer works as expected.


[Bug target/53623] New: [4.7 Regression] sign extension is effectively split into two x86-64 instructions

2012-06-09 Thread adam at consulting dot net.nz
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53623

 Bug #: 53623
   Summary: [4.7 Regression] sign extension is effectively split
into two x86-64 instructions
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: a...@consulting.net.nz


Note: 

#include stdint.h

typedef (*inst_t)(int64_t rdi, int64_t rsi, int64_t rdx);

int16_t code[256];
inst_t dispatch[256];

void an_inst(int64_t rdi, int64_t rsi, int64_t rdx) {
  rdx = code[rdx];
  uint8_t inst = (uint8_t) rdx;
  rdx = 8;
  dispatch[inst](rdi, rsi, rdx);
}

int main(void) {
  return 0;
}

$ gcc-4.6 -O3 sign_extension_regression.c  objdump -d -m i386:x86-64 a.out
|less

004004a0 an_inst:
  4004a0:   48 0f bf 94 12 20 1amovswq 0x601a20(%rdx,%rdx,1),%rdx
  4004a7:   60 00 
  4004a9:   0f b6 c2movzbl %dl,%eax
  4004ac:   48 c1 fa 08 sar$0x8,%rdx
  4004b0:   48 8b 04 c5 20 12 60mov0x601220(,%rax,8),%rax
  4004b7:   00 
  4004b8:   ff e0   jmpq   *%rax

int16_t is sign extended into RDX. RDX is arithmetic shifted down by 8 (after
first extracting DL). Result: RDX contains a sign extended 8-bit value.

$ gcc-4.7 -O3 sign_extension_regression.c  objdump -d -m i386:x86-64 a.out
|less

004004b0 an_inst:
  4004b0:   0f b7 84 12 60 1a 60movzwl 0x601a60(%rdx,%rdx,1),%eax
  4004b7:   00 
  4004b8:   48 0f bf d0 movswq %ax,%rdx
  4004bc:   0f b6 c0movzbl %al,%eax
  4004bf:   48 c1 fa 08 sar$0x8,%rdx
  4004c3:   48 8b 04 c5 60 12 60mov0x601260(,%rax,8),%rax
  4004ca:   00 
  4004cb:   ff e0   jmpq   *%rax

int16_t is loaded into EAX without sign extension. The low 16 bits of EAX are
loaded into RDX with sign extension. RDX is arithmetic shifted down by 8.
Result: RDX contains a sign extended 8-bit value.

This is a regression. gcc-4.6 achieved the same result with one less
instruction.

Note: The quality of the generated code is affect by Bug 45434 and Bug 46219.
Suggested optimal approach with four instructions:

1. movzwl mem16 - edx
2. movzbl dl - eax
3. movsbq dh - rdx
4. complex indrect jmp (combining mov mem64 - rax; jmp rax)


[Bug c++/53624] New: GCC rejects function local types in template function with default template arguments

2012-06-09 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53624

 Bug #: 53624
   Summary: GCC rejects function local types in template function
with default template arguments
Classification: Unclassified
   Product: gcc
   Version: 4.6.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: lu...@math.hu-berlin.de


Created attachment 27595
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27595
testcase

The error occurs when there is at one template argument with default and one
without. Errors are generated for local structs, classes, unions and lambda
functions.
For the attached usecase I get with gcc 4.6.3 and 4.7.0:
C:\dev\projects\compiler testg++ gcc_test2.cpp --std=c++0x -fsyntax-only
gcc_test2.cpp: In function 'void Foo(T)':
gcc_test2.cpp:5:12: error: no default argument for 'T'


[Bug c++/53624] GCC rejects function local types in template function with default template arguments

2012-06-09 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53624

Andrew Pinski pinskia at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID

--- Comment #1 from Andrew Pinski pinskia at gcc dot gnu.org 2012-06-10 
04:24:44 UTC ---
gcc_test2.cpp:5:12: error: no default argument for 'T'

It is not rejecting the local type but rather it is rejecting the second
template argument which does not have a default argument even though the first
argument does.


[Bug c++/53624] GCC rejects function local types in template function with default template arguments

2012-06-09 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53624

--- Comment #2 from Daniel Lunow lunow at math dot hu-berlin.de 2012-06-10 
04:49:29 UTC ---
Their is no requirement (in the c++11 standard) for function templates that
implies subsequent template parameters after a template parameter with default
template argument must also have default template arguments (in contrast to
class templates). In general this works in gcc.
But with the local types inside the template function gcc might reject it
because it creates local types as templated with the same template
parameters/default arguments and checks the requirement for class templates.

The line number/offset in the error message clearly refers to the local struct.


[Bug c++/53624] GCC rejects function local types in template function with default template arguments

2012-06-09 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53624

Andrew Pinski pinskia at gcc dot gnu.org changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|INVALID |

--- Comment #3 from Andrew Pinski pinskia at gcc dot gnu.org 2012-06-10 
04:52:21 UTC ---
Oh I see.
The trunk shows what is going on better:
t.cc: In function ‘void Foo(T)’:
t.cc:4:12: error: no default argument for ‘T’
   struct X {};
^