[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#673749: g++-4.7: gcc47 generates buggy code with optimisation flags

FYI I have also submitted a bug report on GCC Bugzilla [1]


On Mon, May 21, 2012 at 11:31 AM, Christophe Prud'homme <prudhomm@debian.org> wrote:
Please note that 
 - Debug -g
 - RelWithDebInfo uses -g -O1 
 - Release uses -O3

there must be an option in -O1 that generates the buggy code.

Best regards

On Mon, May 21, 2012 at 10:34 AM, Christophe Prud'homme <prudhomm@debian.org> wrote:
Package: g++-4.7
Version: 4.7.0-8
Severity: normal
Tags: upstream

Dear Maintainer,

  * What led up to the situation?
I ported feel++ to gcc47 and found out that it generates buggy code(generating
segfault) in optimisation mode.
Here are the steps to reproduce it
 - install feel++-apps
 - execute feel_doc_myfunctionspace (compiled using CMAKE_BUILD_TYPE=Release)
 - it generates a segfault

what happens is that a data structure containing only a double data member seem
to be optimized away and became dangling reference (invalid read using
The code crashes at line 220 of doc/manual/tutorial/myfunctionspace.cpp when
evaluating the _expression_ template data structure g defined on line 215.

 - in gcc47 with CMAKE_BUILD_TYPE=Debug, it works without problems
 - with gcc45, gcc46, clang31 on Linux and OSX there are no problems at all
  in RelWithDebInfo and Release mode (CMAKE_BUILD_TYPE)

Hence I believe that this is a bug in gcc47 code generation/optimisation.

-- System Information:
Debian Release: wheezy/sid
 APT prefers unstable
 APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages g++-4.7 depends on:
ii  gcc-4.7             4.7.0-8
ii  gcc-4.7-base        4.7.0-8
ii  libc6               2.13-32
ii  libgmp10            2:5.0.5+dfsg-1.1
ii  libmpc2             0.9-4
ii  libmpfr4            3.1.0-5
ii  libstdc++6-4.7-dev  4.7.0-8
ii  zlib1g              1:1.2.7.dfsg-2

g++-4.7 recommends no packages.

Versions of packages g++-4.7 suggests:
pn  g++-4.7-multilib    <none>
pn  gcc-4.7-doc         <none>
pn  libstdc++6-4.7-dbg  <none>

-- no debconf information

Reply to: