Bug 35689 - ostream no longer usable with java exceptions
Summary: ostream no longer usable with java exceptions
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.3.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-25 00:55 UTC by Jack Howarth
Modified: 2008-03-25 01:15 UTC (History)
1 user (show)

See Also:
Host: i686-apple-darwin9
Target: i686-apple-darwin9
Build: i686-apple-darwin9
Known to work:
Known to fail:
Last reconfirmed:


Attachments
compressed preprocessed source file for pdftk.cc (142.19 KB, application/octet-stream)
2008-03-25 01:05 UTC, Jack Howarth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Howarth 2008-03-25 00:55:32 UTC
The pdftk package fails to compile under gcc 4.3.1 from the gcc 4.3 branch due the error...

/sw/lib/gcc4.3/bin/g++ pdftk.cc -I../java_libs -O3 -DPATH_DELIM=0x2f -DASK_ABOUT_WARNINGS=false -fdollars-in-identifiers -DPDFTK_VER=\"1.41\" -c
/sw/lib/gcc4.3/lib/gcc/i686-apple-darwin9/4.3.1/../../../../include/c++/4.3.1/bits/ostream_insert.h: In function 'std::basic_ostream<_CharT, _Traits>& std::__ostream_insert(std::basic_ostream<_CharT, _Traits>&, const _CharT*, std::streamsize) [with _CharT = char, _Traits = std::char_traits<char>]':
/sw/lib/gcc4.3/lib/gcc/i686-apple-darwin9/4.3.1/../../../../include/c++/4.3.1/ostream:517:   instantiated from 'std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*) [with _Traits = std::char_traits<char>]'
pdftk.cc:114:   instantiated from here
/sw/lib/gcc4.3/lib/gcc/i686-apple-darwin9/4.3.1/../../../../include/c++/4.3.1/bits/ostream_insert.h:107: error: mixing C++ and Java catches in a single translation unit

This error occurs for any cerr or cout in pdftk.cc.
Comment 1 Jack Howarth 2008-03-25 00:57:50 UTC
This regression doesn't exist in gcc 4.2.3 on i686-apple-darwin9.
Comment 2 Andrew Pinski 2008-03-25 01:03:54 UTC
I don't think this is a GCC bug at all.  libstdc++ can use exceptions freely really since it is C++ code.   Since there is no way to combine C++ and Java exceptions in one TU, we reject the code.  Now there is exception usage in ostream, yes this is new for 4.3.0 but does not mean it is a bug in GCC.
Comment 3 Jack Howarth 2008-03-25 01:05:01 UTC
Created attachment 15372 [details]
compressed preprocessed source file for pdftk.cc

File generated with...

/sw/lib/gcc4.3/bin/g++ pdftk.cc -I../java_libs -O3 -E -o pdftk.i -DPATH_DELIM=0x2f -DASK_ABOUT_WARNINGS=false -fdollars-in-identifiers -DPDFTK_VER=\"1.41\" -c
Comment 4 Andrew Pinski 2008-03-25 01:08:23 UTC
Basically it is wrong that pdftk is using C++ I/O here really but instead java I/O.

Anyways this is the correct error.
Comment 5 Jack Howarth 2008-03-25 01:12:27 UTC
So it is meaningless now to attempt to set

#pragma GCC java_exceptions

in c++ code?
Comment 6 Andrew Pinski 2008-03-25 01:15:27 UTC
(In reply to comment #5)
> So it is meaningless now to attempt to set
> 
> #pragma GCC java_exceptions
> 
> in c++ code?

This is C++ code but it is CNI code also so setting that is ok.

-- Pinski