[Bug pch/39420] New: Using pre-compiled headers results in a bus error

2009-03-10 Thread johnw at gnu dot org
I've tried to reduce this down to a smaller case, but using -save-temps
resulted in a file which does not manifest the problem.  But then, maybe it
shouldn't have.

My project is publically avaliable at http://github.com/jwiegley/ledger. 
Perhaps this is too oblique, but if you pull the project and run "./acprep make
--no-patch --pch", it will generate a Bus Error when compiling as follows
(assuming you have Boost, GMP and MPFR devel libraries installed as well):

libtool: compile:  /opt/local/bin/g++-mp-4.4 -DHAVE_CONFIG_H -I.
-I/Users/johnw/Projects/ledger -I/Users/johnw/Projects/ledger/src
-I/Users/johnw/Projects/ledger/lib
-I/Users/johnw/Projects/ledger/lib/utfcpp/source -isystem /usr/local/include
-isystem /usr/local/include/boost-1_38 -isystem /usr/local/include -isystem
/usr/include/python2.5 -isystem /opt/local/include -isystem
/usr/local/stow/cppunit/include -fpch-deps -Wconversion -ansi -Wall
-Winvalid-pch -Wextra -Wcast-align -Wcast-qual -Wfloat-equal
-Wmissing-field-initializers -Wno-endif-labels -Woverloaded-virtual
-Wsign-compare -Wsign-promo -Wstrict-null-sentinel -Wwrite-strings
-Wno-old-style-cast -Wno-deprecated -g -pipe -MT libledger_report_la-stats.lo
-MD -MP -MF .deps/libledger_report_la-stats.Tpo -c
/Users/johnw/Projects/ledger/src/stats.cc -o libledger_report_la-stats.o
cc1plus: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[2]: *** [libledger_report_la-stats.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

If I run with -H, I see:

. /Users/johnw/Projects/ledger/src/derive.h
.. /Users/johnw/Projects/ledger/src/value.h
... /Users/johnw/Projects/ledger/src/balance.h
 /Users/johnw/Projects/ledger/src/amount.h
. /Users/johnw/Projects/ledger/src/utils.h
.! ./system.hh.gch
 /Users/johnw/Projects/ledger/src/utils.h
. /Users/johnw/Projects/ledger/src/error.h
.. /Users/johnw/Projects/ledger/src/accum.h
 /Users/johnw/Projects/ledger/src/times.h
 /Users/johnw/Projects/ledger/src/flags.h
 (null)
 /Users/johnw/Projects/ledger/src/mask.h
 (null)
 /Users/johnw/Projects/ledger/src/xact.h
. /Users/johnw/Projects/ledger/src/item.h
.. /Users/johnw/Projects/ledger/src/scope.h
... /Users/johnw/Projects/ledger/src/op.h
 /Users/johnw/Projects/ledger/src/expr.h
. /Users/johnw/Projects/ledger/src/predicate.h
.. /Users/johnw/Projects/ledger/src/commodity.h
 /Users/johnw/Projects/ledger/src/post.h
 /Users/johnw/Projects/ledger/src/account.h
 /Users/johnw/Projects/ledger/src/report.h
. /Users/johnw/Projects/ledger/src/interactive.h
. /Users/johnw/Projects/ledger/src/chain.h
. /Users/johnw/Projects/ledger/src/stream.h
. /Users/johnw/Projects/ledger/src/option.h
 /Users/johnw/Projects/ledger/src/session.h
. /Users/johnw/Projects/ledger/src/journal.h
.. /Users/johnw/Projects/ledger/src/hooks.h
 (null)
cc1plus: internal compiler error: Bus error

I'm running on OS X 10.5.6, although I see the same bug on the latest Ubuntu
using g++ 4.3.

My gcc version is: gcc-mp-4.4 (GCC) 4.4.0 20090306 (experimental)

System uname -a: Darwin Hermes 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24
17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386

This bug happens with 4.3.3 on my system as well, but works exactly as expected
with 4.2.1:

i686-apple-darwin9-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5566)


-- 
   Summary: Using pre-compiled headers results in a bus error
   Product: gcc
   Version: 4.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: pch
AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: johnw at gnu dot org


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



[Bug pch/39420] Using pre-compiled headers results in a bus error

2009-03-10 Thread johnw at gnu dot org


--- Comment #1 from johnw at gnu dot org  2009-03-10 08:42 ---
Created an attachment (id=17435)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17435&action=view)
The file resulting from using -save-temps

This code uses Boost extensively, although I don't know if that has any bearing
on the matter.


-- 


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



[Bug pch/39420] Using pre-compiled headers results in a bus error

2009-03-10 Thread johnw at gnu dot org


--- Comment #3 from johnw at gnu dot org  2009-03-10 19:32 ---
Hmm... I have ensured that the #include chain in every source file results in
the given header appearing first.  That is, whatever a file includes, it will
include utils.h, which includes system.hh.  And so, it works with 4.2 just fine
(I checked using -H, to ensure the includes it actually does process are the
right ones).  So why would it start crashing with 4.3?

Also, -include is not a portable option.  I'll just reorganize my code.  Thanks
for the quick response!!


-- 


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



[Bug libstdc++/24196] Using string instances to pass arguments to dlls fails

2009-10-24 Thread johnw at gnu dot org


--- Comment #21 from johnw at gnu dot org  2009-10-25 05:40 ---
I'm actually getting this same error on Snow Leopard (Mac OS X 10.6.0).  It's
pretty easy to reproduce with Boost (1.40):

#include 
#include 

#include 

int main()
{
  std::ostringstream buf;
  boost::variant data;
  data = buf.str();
  data = false;
  return 0;
}

$ g++ -I/opt/local/include -o bug bug.cc

What happens here is that ostringstream, which is in libstdc++.dylib, returns
an empty string which does not match the notion of empty string compiled into
my executable; thus when Boost tries to deconstruct the string it stored in
order to store the boolean, it crashes trying to deallocate a foreign lib's
empty string.

This doesn't happen with the same Boost using the stock compiler (g++ 4.2).

John


-- 

johnw at gnu dot org changed:

   What|Removed |Added

 CC|                |johnw at gnu dot org


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



[Bug libstdc++/24196] Using string instances to pass arguments to dlls fails

2009-10-24 Thread johnw at gnu dot org


--- Comment #22 from johnw at gnu dot org  2009-10-25 05:43 ---
A little more data:

With the stock compiler, g++ 4.2.1:

vulcan /tmp $ otool -L bug
bug:
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 123.0.0)
vulcan /tmp $ nm -o /usr/lib/libstdc++.6.dylib | grep empty_rep
0003f200 T __ZNSbIwSt11char_traitsIwESaIwEE12_S_empty_repEv
0003f2fd T __ZNSbIwSt11char_traitsIwESaIwEE4_Rep12_S_empty_repEv
0006fe50 S __ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE
0002fae3 T __ZNSs12_S_empty_repEv
0002fbe7 T __ZNSs4_Rep12_S_empty_repEv
0006fdb0 S __ZNSs4_Rep20_S_empty_rep_storageE
vulcan /tmp $ nm bug | grep empty_rep   
00011fc7 T __ZNSs12_S_empty_repEv
00011f14 T __ZNSs4_Rep12_S_empty_repEv
0001dd00 D __ZNSs4_Rep20_S_empty_rep_storageE

With the compiler built from MacPorts, g++ 4.4.2:

vulcan /tmp $ otool -L bug
bug:
/opt/local/lib/gcc44/libstdc++.6.dylib (compatibility version 7.0.0,
current version 7.13.0)
/opt/local/lib/gcc44/libgcc_s.1.dylib (compatibility version 1.0.0,
current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 123.0.0)
vulcan /tmp $ nm /opt/local/lib/gcc44/libstdc++.6.dylib | grep empty_rep 
000655c0 T __ZNSbIwSt11char_traitsIwESaIwEE12_S_empty_repEv
000658c0 T __ZNSbIwSt11char_traitsIwESaIwEE4_Rep12_S_empty_repEv
000bbe40 D __ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE
0004de20 T __ZNSs12_S_empty_repEv
0004e0e0 T __ZNSs4_Rep12_S_empty_repEv
000bbdc0 D __ZNSs4_Rep20_S_empty_rep_storageE
vulcan /tmp $ nm bug | grep empty_rep   
0001193b T __ZNSs4_Rep12_S_empty_repEv
00017820 D __ZNSs4_Rep20_S_empty_rep_storageE


-- 


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



[Bug libstdc++/24196] Using string instances to pass arguments to dlls fails

2009-10-24 Thread johnw at gnu dot org


--- Comment #23 from johnw at gnu dot org  2009-10-25 05:50 ---
I should also mention, this discrepancy only occurs when _GLIBCXX_DEBUG=1.


-- 


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