Bug 46333 - problems with configure -enable-build-with-cxx -disable-bootstrap
Summary: problems with configure -enable-build-with-cxx -disable-bootstrap
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-06 15:51 UTC by Jay
Modified: 2024-03-31 21:23 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2023-04-12 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jay 2010-11-06 15:51:37 UTC
Hi..so, I'm using configure -enable-build-with-cxx, with 4.5.1.


One person's machine has g++ 3.3.
Another's g++ produces executables that don't run, can't find libstdc++.
  So autoconf decides sizeof(int) == 0.
  On that machine, I'm instead trying /usr/bin/CC which is SunStudio 12.
  

Here are some of the problem.
I'm going to try to patch them all, but I don't have FSF papers.



g++ 3.3 doesn't like ATTRIBUTE_UNUSED after parameters,
as ansidecl.h says. But ARG_UNUSED isn't used much.
So:


/* Before GCC 3.4, the C++ frontend couldn't parse attributes placed after the
   identifier name. ATTRIBUTE_UNUSED is frequently used instead of
   ARG_UNUSED. */

#ifndef ATTRIBUTE_UNUSED
#if ! defined(__cplusplus) || (GCC_VERSION >= 3004)
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#else
#define ATTRIBUTE_UNUSED /* nothing */
#endif
#endif
#define ARG_UNUSED(NAME) NAME ATTRIBUTE_UNUSED



ENUM_BITFIELD mixes integers and enums.
Fix:
#if (GCC_VERSION > 2000)
#define ENUM_BITFIELD(TYPE, NAME, SIZE) __extension__ enum TYPE NAME : SIZE
#elif defined(__cplusplus)
#define ENUM_BITFIELD(TYPE, NAME, SIZE) enum TYPE NAME
#else
#define ENUM_BITFIELD(TYPE, NAME, SIZE) unsigned int
#endif


(in two copies of system.h)


but that breaks gengtype!
So I put in:
"ENUM_BITFIELD"{WS}?"("{WS}?{ID}{WS}?,{WS}?{ID}{WS}?,{WS}?[_0-9A-Z]+{WS}?");" {
  /* do nothing */
}

not sure that is right!


some problem with obstack_free, I didn't investigate.
Maybe substraction involving void* NULL or 0?
Fix, obstack.h before:
Before:
# define obstack_free(h,obj)						\
( (h)->temp = (char *) (obj) - (char *) (h)->chunk,			\

After, add cast to char*:
# define obstack_free(h,obj)						\
( (h)->temp = (char *) ((char*)(obj)) - (char *) (h)->chunk,			\


ambiguity passing WIDE_INT to abs.
fix:
  in hwint.h define wide_abs to labs, llabs, or _abs64
  and use wide_abs
 
 
 There are also problems then compiling gmp in tree.
 I had to remove its #include <iosfwd> on Solaris because
 that pulled in locale and there was some problem.
    Maybe due to local hacks? I removed all the locale stuff from my gcc/gmp.
 
   
 gmp also had using std::FILE which failed, I removed it.
 


oh, and I'm using a bit of C++.
gengtype doesn't like typedef vector<int> foo_t or destructors.
I worked around like so:


#include <vector>
using namespace std;
#define typedef_vector typedef vector /* hack for gengtype */


and then typedef_vector<int> foo_t;



and


#define DESTRUCTOR ~ /* hack for gengtype */

struct bar_t
{
  bar_t() { }
  virtual DESTRUCTOR bar_t() { }
Comment 1 Jay 2010-11-06 16:25:26 UTC
also a bunch of gcc options are being passed to CC, odd
I set CXX=/usr/bin/CC to get here.


CC: Warning: Option -Wno-long-long passed to ld, if ld is invoked, ignored otherwise
source='../../gcc-4.5/libcpp/expr.c' object='expr.o' libtool=no DEPDIR=.deps depmode=dashXmstdout /bin/bash ../../gcc-4.5/libcpp/../depcomp /usr/bin/CC  -I../../gcc-4.5/libcpp -I. -I../../gcc-4.5/libcpp/../include -I../../gcc-4.5/libcpp/include  -g -W -Wall -Wwrite-strings -Wmissing-format-attribute -pedantic -Wno-long-long  -I../../gcc-4.5/libcpp -I. -I../../gcc-4.5/libcpp/../include -I../../gcc-4.5/libcpp/include  -c ../../gcc-4.5/libcpp/expr.c
CC: Warning: Option -W passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -Wall passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -Wwrite-strings passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -Wmissing-format-attribute passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -pedantic passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -Wno-long-long passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -W passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -Wall passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -Wwrite-strings passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -Wmissing-format-attribute passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -pedantic passed to ld, if ld is invoked, ignored otherwise



also lots of warnings about mixing extern "C" and not:

"../../gcc-4.5/libcpp/files.c", line 1173: Warning (Anachronism): Formal argument 2 of type extern "C" unsigned(*)(const void*) in call to htab_create_alloc(unsigned, extern "C" unsigned(*)(const void*), extern "C" int(*)(const void*,const void*), extern "C" void(*)(void*), extern "C" void*(*)(unsigned,unsigned), extern "C" void(*)(void*)) is being passed unsigned(*)(const void*).
"../../gcc-4.5/libcpp/files.c", line 1173: Warning (Anachronism): Formal argument 3 of type extern "C" int(*)(const void*,const



and other errors related, mixing said in ternary, like:


foo = foo2 ? foo2 : foo3;
 (as in reallocator = set->reallocator ? set->reallocator : xrealloc)


where foo2 and foo3 vary in extern C-ness.
workaround is
foo = foo2
if (!foo)
  foo = foo3

even though that doesn't seem different enough -- I understand there is the problem of figuring out a type for the ternary operator, but there is also the matter of being able to assign the function pointers



here's an example of the obtack_free problem, either I didn't get all the obstack.h files fixed or the cast needs to be void* or something:


"../../gcc-4.5/libcpp/files.c", line 1193: Error: Cannot assign char* to int.
Comment 2 jsm-csl@polyomino.org.uk 2010-11-06 17:24:11 UTC
On Sat, 6 Nov 2010, jay.krell at cornell dot edu wrote:

> One person's machine has g++ 3.3.

In the discussions of what the requirements would be for building with 
C++, I think it was generally accepted that the answer would be the 
intersection of C++98 with what is supported by some baseline GCC version 
- and that at least 3.4, maybe 4.0 or 4.1, would be OK to take as that 
baseline.  (PPL is a C++ library that won't build with versions older than 
4.0, so anyone building a Graphite-enabled compiler is using a C++ 
compiler more recent than 3.4 already.)

Yes, we should have a configure test that rules out known-too-old 
compilers.

> Another's g++ produces executables that don't run, can't find libstdc++.

For build = host, a configure test for that may be useful as well.

>   On that machine, I'm instead trying /usr/bin/CC which is SunStudio 12.

If that supports C++98 at least as well as GCC 3.4 does, then it ought to 
work - and having people testing such things will be very useful for 
verifying that we aren't introducing accidental G++ dependencies when 
making C++ builds a requirement.  You may be the first person testing 
non-G++ C++ builds.
Comment 3 Richard Biener 2010-11-06 20:48:33 UTC
Note that it might be more useful to test the current trunk (not that the
issues are likely to have been addressed there already).
Comment 4 Jay 2010-11-06 23:53:47 UTC
"../../gcc-4.5/gcc/opts.c", line 1233: Error: The function "__flsbuf" must have a prototype.
"../../gcc-4.5/gcc/opts.c", line 1350: Error: The function "__flsbuf" must have a prototype.

#if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
        __cplusplus < 199711L
...
#ifndef _LP64
extern int      __filbuf(FILE *);
extern int      __flsbuf(int, FILE *);
#endif  /*      _LP64   */

#else   /* !defined __STDC__ */


either need to #if __GNUC__ around #define foo foo_unlocked
or need to define __REENTRANT.

This is all on Solaris 2.9, which may be out of support soon.
I can move to Solaris 2.10.

I need gcc 4.5.1. I can look into trunk *later*.

Some of my own patches run afoul of SunStudio 12 C++, that maybe
unique to me, e.g.:

bool unused_gcc_feature (...) { gcc_unreachable (); }

 => unused_gcc_feature must return a value
  so I put in return 0; unpatched gcc doesn't necessarily have this.


I'm not 100% which older g++ is on the other machine, just that it had problem with attribute(unused).  However, I bet it is easier to use than non-g++! :)

Also my ENUM_BITFIELD has an obvious typo in the last case, it need to reference NAME.

 
Later,
 - Jay
Comment 5 Jay 2010-11-07 00:07:31 UTC
Huh, I misread and I don't see why _flsbuf/__flsbuf/_filbuf/__filbuf aren't declared.
Anyway, I'll try:

# if defined(HAVE_PUTC_UNLOCKED) && (!defined(__cplusplus) || defined(__GNUC__) || !defined(__sun))

on
#  define putc(C, Stream) putc_unlocked (C, Stream)

and analogous on
#  define getc(Stream) getc_unlocked (Stream)
Comment 6 Jay 2010-11-07 00:15:05 UTC
trying..
#if defined(__cplusplus) && !defined(__GNUC__) && defined(__sun)
#undef HAVE_PUTC_UNLOCKED
#undef HAVE_PUTCHAR_UNLOCKED
#undef HAVE_GETC_UNLOCKED
#undef HAVE_GETCHAR_UNLOCKED
#endif
Comment 7 Jay 2010-11-07 00:28:39 UTC
rtl.c:
"../../gcc-4.5/gcc/rtl.def", line 82: Error: Badly formed constant expression.
"../../gcc-4.5/gcc/rtl.def", line 89: Error: "}" expected instead of "sizeof".


rtl.c, change:

#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   sizeof FORMAT - 1 ,

to:

#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   sizeof (FORMAT) - 1 ,

seems to work. Seems preferable too.
Comment 8 Jay 2010-11-07 00:30:29 UTC
an example of the gcc_unreachable problem that I don't think I caused:

"../../gcc-4.5/gcc/targhooks.c", line 85: Error: "default_legitimate_address_p(machine_mode, rtx_def*, bool)" is expected to return a value.
"../../gcc-4.5/gcc/targhooks.c", line 938: Error: "default_addr_space_convert(rtx_def*, tree_node*, tree_node*)" is expected to return a value.

I suggest putting in "return 0;" at end.
Comment 9 Jay 2010-11-07 00:50:02 UTC
Here is an example that occurs many times, warning only:

extern "C" { void F1(void); }

void (*F2)(void) = F1;

-bash-4.1$ /usr/bin/CC -c $HOME/1.cpp
"/home/jkrell/1.cpp", line 5: Warning (Anachronism): Using extern "C" void(*)() to initialize void(*)().
1 Warning(s) detected.

-bash-4.1$ uname -a
SunOS current10s 5.10 Generic_142909-17 sun4v sparc SUNW,SPARC-Enterprise-T5220
Comment 10 Jay 2010-11-07 01:10:56 UTC
Undefined                       first referenced
 symbol                             in file
__gmpn_add                          /home/jkrell/dev2/cm3/m3-sys/m3cc/SOLsun/./gmp/.libs/libgmp.a(add.o)
__gmpn_cmp                          /home/jkrell/dev2/cm3/m3-sys/m3cc/SOLsun/./gmp/.libs/libgmp.a(add.o)
__gmpn_sub                          /home/jkrell/dev2/cm3/m3-sys/m3cc/SOLsun/./gmp/.libs/libgmp.a(add.o)
__gmpn_add_1                        /home/jkrell/dev2/cm3/m3-sys/m3cc/SOLsun/./gmp/.libs/libgmp.a(add_ui.o)
__gmpn_sub_1                        /home/jkrell/dev2/cm3/m3-sys/m3cc/SOLsun/./gmp/.libs/libgmp.a(add_ui.o)


trying extern "C" in gmp-in.h
Comment 11 Jay 2010-11-07 01:19:03 UTC
fyi, even with modern g++ 4.0, there are many warnings, e.g.:

./../gcc-4.5/gcc/postreload.c: In function ‘void reload_cse_regs_1(rtx_def*)’:
../../gcc-4.5/gcc/postreload.c:199: warning: passing negative value ‘-0x00000000
Comment 12 Jay 2010-11-07 01:37:15 UTC
Huh, maybe enum bitfields are legal C++?

#if defined(__cplusplus)
#define ENUM_BITFIELD(TYPE, NAME, SIZE) enum TYPE NAME : SIZE


seems to work, so can go back to the 1 parameter version, and not change gengtype.
I will try it.
Comment 13 Jay 2010-11-07 02:04:14 UTC
gmpn_add/sub/cmp were because I have drastically slashed mpc/mpfr/gmp dependency, and optimizations off here. That is fixed.
Now I can compile/link our cc1 analog!
That's all we use.
I can maybe continue this adventure with unpatched gmp/mpfr/mpc, trunk gcc, I'd limit myself to C and C++ frontends if I do. It could well be that without -disable-bootstrap, it doesn't use C++ until later stages and then works.
Comment 14 Jay 2010-11-07 04:03:13 UTC
../../gcc-4.5/gcc/combine.c", line 6561: Error: Unexpected type name "rtl_hooks" encountered.
../../gcc-4.5/gcc/combine.c", line 6561: Error: Unexpected type name "rtl_hooks" encountered.

so change the type to rtl_hooks_t

(This is on Solaris 2.10 now, as I hit other problems on 2.9.)

a new warning:
"../../gcc-4.5/gcc/bitmap.c", line 315: Warning (Anachronism): Attempt to redefine __alignof__ without using #undef.
Comment 15 Jay 2010-11-07 04:13:30 UTC
hm..or maybe the Sun CC recurses here?
rtl.h:#define gen_lowpart rtl_hooks.gen_lowpart

maybe #undef gen_lowpower and use rtl_hooks.gen_lowpart?
or rename the member to gen_lowpower_hook?
Comment 16 Jay 2010-11-07 04:20:47 UTC
I went with renaming the member to gen_lowerpart_, with underscore at the end.
There are no references to it except for the macro, it appears.
-bash-4.1$ CC -V
CC: Sun C++ 5.9 SunOS_sparc 2007/05/03
-bash-4.1$ uname -a
SunOS current10s 5.10 Generic_142909-17 sun4v sparc SUNW,SPARC-Enterprise-T5220
Comment 17 Jay 2010-11-07 23:01:14 UTC
unpatched trunk, same as 4.5.1:


 /home/jkrell/src/gcc-trunk/configure -prefix=$HOME/test1 -enable-build-with-cxx && gmake 
 
 
gmake[3]: Entering directory `/home/jkrell/obj/a/libcpp'
source='/home/jkrell/src/gcc-trunk/libcpp/charset.c' object='charset.o' libtool=no DEPDIR=.deps depmode=dashXmstdout /bin/bash /home/jkrell/src/gcc-trunk/libcpp/../depcomp CC  -I/home/jkrell/src/gcc-trunk/libcpp -I. -I/home/jkrell/src/gcc-trunk/libcpp/../include -I./../intl -I/home/jkrell/src/gcc-trunk/libcpp/include  -g  -I/home/jkrell/src/gcc-trunk/libcpp -I. -I/home/jkrell/src/gcc-trunk/libcpp/../include -I./../intl -I/home/jkrell/src/gcc-trunk/libcpp/include  -c /home/jkrell/src/gcc-trunk/libcpp/charset.c
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 619: Warning (Anachronism): Using bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to initialize extern "C" bool(*const)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 620: Warning (Anachronism): Using bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to initialize extern "C" bool(*const)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 621: Warning (Anachronism): Using bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to initialize extern "C" bool(*const)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 622: Warning (Anachronism): Using bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to initialize extern "C" bool(*const)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 623: Warning (Anachronism): Using bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to initialize extern "C" bool(*const)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 624: Warning (Anachronism): Using bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to initialize extern "C" bool(*const)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 625: Warning (Anachronism): Using bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to initialize extern "C" bool(*const)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 626: Warning (Anachronism): Using bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to initialize extern "C" bool(*const)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 643: Warning (Anachronism): Assigning bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 666: Warning (Anachronism): Assigning bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 679: Warning (Anachronism): Assigning bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 687: Warning (Anachronism): Assigning bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 744: Warning (Anachronism): The operation "extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) == bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*)" is illegal.
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 746: Warning (Anachronism): The operation "extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) == bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*)" is illegal.
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 748: Warning (Anachronism): The operation "extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) == bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*)" is illegal.
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 750: Warning (Anachronism): The operation "extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) == bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*)" is illegal.
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 752: Warning (Anachronism): The operation "extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) == bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*)" is illegal.
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 1459: Warning (Anachronism): Assigning bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) to extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*).
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 1707: Warning (Anachronism): The operation "extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) == bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*)" is illegal.
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 1728: Warning (Anachronism): The operation "extern "C" bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*) == bool(*)(_iconv_info*,const unsigned char*,unsigned,_cpp_strbuf*)" is illegal.


"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 1615: Error: Formal argument type of type cpp_ttype in call to cpp_interpret_string(cpp_reader*, const cpp_string*, unsigned, cpp_string*, cpp_ttype) is being passed const unsigned.
"/home/jkrell/src/gcc-trunk/libcpp/charset.c", line 1620: Error: Formal argument type of type cpp_ttype in call to wide_str_to_charconst(cpp_reader*, cpp_string, unsigned*, int*, cpp_ttype) is being passed const unsigned.


2 Error(s) and 20 Warning(s) detected.

-bash-4.1$ env | grep CC
CXX=CC
CC=cc

-bash-4.1$ uname -a
SunOS current10s 5.10 Generic_142909-17 sun4v sparc SUNW,SPARC-Enterprise-T5220


-bash-4.1$ $CXX -V
CC: Sun C++ 5.9 SunOS_sparc 2007/05/03


-bash-4.1$ $CC -V
cc: Sun C 5.9 SunOS_sparc 2007/05/03


The errors are easy to fix.
The warnings are too, but they are so many.


 - Jay
Comment 18 Jay 2010-11-08 00:57:29 UTC
more gcc_unreachable and then functions not returning, slightly 4.5.1 with Sun CC (C++):


see http://hudson.modula3.com:8080/job/cm3-current-m3cc-I386_SOLARIS-opencsw-current10x/105/console



/usr/bin/CC -c -g -DIN_GCC -DHAVE_CONFIG_H -I. -I. -I../../gcc-4.5/gcc -I../../gcc-4.5/gcc/. -I../../gcc-4.5/gcc/../include -I../../gcc-4.5/gcc/../libcpp/include -I/home/m3hudson/current10x/workspace/cm3-current-m3cc-I386_SOLARIS-opencsw-current10x/cm3/m3-sys/m3cc/I386_SOLARIS/./gmp -I/home/m3hudson/current10x/workspace/cm3-current-m3cc-I386_SOLARIS-opencsw-current10x/cm3/m3-sys/m3cc/gcc-4.5/gmp -I/usr/include/libelf insn-output.c -o insn-output.o




"../../gcc-4.5/gcc/config/i386/i386.md", line 2987: Error: "output_100(rtx_def**, rtx_def*)" is expected to return a value. "../../gcc-4.5/gcc/config/i386/i386.md", line 2999: Error: "output_101(rtx_def**, rtx_def*)" is expected to return a value.



"../../gcc-4.5/gcc/config/i386/i386.md", line 3490: Error: "output_106(rtx_def**, rtx_def*)" is expected to return a value. 



"../../gcc-4.5/gcc/config/i386/i386.md", line 3502: Error: "output_107(rtx_def**, rtx_def*)" is expected to return a value. "../../gcc-4.5/gcc/config/i386/i386.md", line 3643: Error: "output_111(rtx_def**, rtx_def*)" is expected to return a value. 



I put "return 0;" after the gcc_unreachable.
Comment 19 Jay 2010-11-08 11:50:35 UTC
Hey, g++ 4.0 doesn't even like all of the code.
 You have to try "all targets" to uncover some of it.

target=alpha-dec-vms: 


g++ -c  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -W
missing-format-attribute   -DHAVE_CONFIG_H -I. -I. -I../../gcc-4.5/gcc -I../../g
cc-4.5/gcc/. -I../../gcc-4.5/gcc/../include -I../../gcc-4.5/gcc/../libcpp/includ
e -I/Users/jay/dev2/cm3/m3-sys/m3cc/AMD64_DARWIN-ALPHA32_VMS/./gmp -I/Users/jay/
dev2/cm3/m3-sys/m3cc/gcc-4.5/gmp      ../../gcc-4.5/gcc/vmsdbgout.c -o vmsdbgout
.o
../../gcc-4.5/gcc/vmsdbgout.c:1944: error: integer constant is too large for 'lo
ng' type
../../gcc-4.5/gcc/vmsdbgout.c: In function 'int write_modbeg(int)':
../../gcc-4.5/gcc/vmsdbgout.c:746: error: invalid conversion from 'unsigned int'
 to 'DST_LANGUAGE'
../../gcc-4.5/gcc/vmsdbgout.c: In function 'int write_rtnbeg(int, int)':
../../gcc-4.5/gcc/vmsdbgout.c:825: error: invalid conversion from 'int' to '_DST
_TYPE'
make: *** [vmsdbgout.o] Error 1



jbook2:python jay$ g++ -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5493~1/src/configure --disable-checking -enabl
e-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++
 --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/includ
e/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple
 --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5493)
Comment 20 jsm-csl@polyomino.org.uk 2010-11-08 13:12:11 UTC
There really is absolutely no point experimenting with this option 
anywhere other than on trunk.  Maybe we should just disable it on 4.5 
branch; it's a GCC-developer-only option at this point.

*Many* problems with C++ compatibility have been fixed on trunk since 4.5 
branched.  See Joern's work on fixing problems building different targets 
with --enable-werror-always (many of the problems fixed are C++ 
compatibility warnings).  No such fixes will be backported to 4.5 branch.  
Since we're now in development stage 3, I expect that the default build 
will not be C++ until after 4.6 branches, which means that C++ fixes will 
not be backported to 4.6 branch either once that branch is created.  Bug 
reports and fixes for such issues are only useful for trunk, and they are 
only useful when each separate problem (each problem with a genuinely 
different cause) is reported as a separate well-defined bug report; 
omnibus issues mixing different problems are useless, although meta-bugs 
marked as depending on the individual C++-compatibility bugs can be 
useful.  As it happens we have such a bug: bug 44433.  So when you have a 
well-defined issue verified to exist on trunk and to be distinct from all 
existing bugs, only then file a separate bug for that issue and mark it as 
blocking bug 44433.
Comment 21 Marc Glisse 2011-09-04 20:08:49 UTC
Since I went through the same thing recently:

(In reply to comment #0)
> ENUM_BITFIELD mixes integers and enums.
> Fix:
> #if (GCC_VERSION > 2000)
> #define ENUM_BITFIELD(TYPE, NAME, SIZE) __extension__ enum TYPE NAME : SIZE
> #elif defined(__cplusplus)
> #define ENUM_BITFIELD(TYPE, NAME, SIZE) enum TYPE NAME
> #else
> #define ENUM_BITFIELD(TYPE, NAME, SIZE) unsigned int
> #endif

Patch posted at:
http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00758.html

> some problem with obstack_free, I didn't investigate.
> Maybe substraction involving void* NULL or 0?
> Fix, obstack.h before:
> Before:
> # define obstack_free(h,obj)                        \
> ( (h)->temp = (char *) (obj) - (char *) (h)->chunk,            \
> 
> After, add cast to char*:
> # define obstack_free(h,obj)                        \
> ( (h)->temp = (char *) ((char*)(obj)) - (char *) (h)->chunk,            \

Bug in sunpro, reported and fixed in the development version (but possibly not for 12.3).

>  There are also problems then compiling gmp in tree.
>  I had to remove its #include <iosfwd> on Solaris because
>  that pulled in locale and there was some problem.
>     Maybe due to local hacks? I removed all the locale stuff from my gcc/gmp.

CC is not a standard C++ compiler, you have to add -library=stlport4 to get it to even try.


(In reply to comment #1)
> also lots of warnings about mixing extern "C" and not:

Seems ok to ignore those that are only warnings.

> and other errors related, mixing said in ternary, like:
> 
> foo = foo2 ? foo2 : foo3;
>  (as in reallocator = set->reallocator ? set->reallocator : xrealloc)
> 
> 
> where foo2 and foo3 vary in extern C-ness.
> workaround is
> foo = foo2
> if (!foo)
>   foo = foo3
> 
> even though that doesn't seem different enough -- I understand there is the
> problem of figuring out a type for the ternary operator, but there is also the
> matter of being able to assign the function pointers

This one is also Bug 50177. There is also Bug 50167.

> here's an example of the obtack_free problem, either I didn't get all the
> obstack.h files fixed or the cast needs to be void* or something:
> 
> "../../gcc-4.5/libcpp/files.c", line 1193: Error: Cannot assign char* to int.

Patch posted at:
http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00758.html

(In reply to comment #7)
> rtl.c, change:
> 
> #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   sizeof FORMAT - 1 ,
> 
> to:
> 
> #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   sizeof (FORMAT) - 1 ,
> 
> seems to work. Seems preferable too.

Bug in sunpro, reported and fixed in the development version (but possibly not for 12.3).
Comment 22 Marc Glisse 2013-07-12 21:06:47 UTC
Did someone try to bootstrap gcc using CC=suncc CXX='sunCC -library=stlport4' recently? Is this PR still relevant?
Comment 23 Sergey 2014-01-29 11:05:50 UTC
I'm still getting the same with sunpro building gcc 4.8.2

cc -V:
cc: Sun C 5.9 SunOS_i386 Patch 124868-01 2007/07/12
Comment 24 Jonathan Wakely 2014-01-29 11:12:25 UTC
(In reply to Sergey from comment #23)
> I'm still getting the same with sunpro building gcc 4.8.2

What do you mean "the same"?  Are you using --enable-build-with-cxx for GCC 4.8.2? Are you using --disable-bootstrap with sunpro?  If so, why?

Are you using -library=stlport4?

Just saying "getting the same" with no other information about what you're doing is not very helpful.
Comment 25 Sergey 2014-01-29 12:11:26 UTC
Sorry. I mean i am getting the following error:
> "../../gcc-4.5/libcpp/files.c", line 1193: Error: Cannot assign char* to int.
this is obstack related stuff.

The following does not compile:
  obstack_free (&pfile->nonexistent_file_ob, 0);

modifying it this way:
obstack_free (&pfile->nonexistent_file_ob, (void*)0);
helps with compilation.

Also happens in symtab.c, init.c, identifiers.c.

And yes, i'm building cpp & disable bootstrap if that counts.
Comment 26 Marc Glisse 2014-01-29 17:25:17 UTC
(In reply to Sergey from comment #23)
> cc -V:
> cc: Sun C 5.9 SunOS_i386 Patch 124868-01 2007/07/12

That thing belongs in a museum.
Comment 27 Jay 2014-01-29 17:41:37 UTC
The patch looks very very reasonable
imho. I had a few reasonable patches.

 - Jay

On Jan 29, 2014, at 9:25 AM, "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46333
> 
> --- Comment #26 from Marc Glisse <glisse at gcc dot gnu.org> ---
> (In reply to Sergey from comment #23)
>> cc -V:
>> cc: Sun C 5.9 SunOS_i386 Patch 124868-01 2007/07/12
> 
> That thing belongs in a museum.
> 
> -- 
> You are receiving this mail because:
> You reported the bug.
Comment 28 Jonathan Wakely 2023-04-12 16:51:59 UTC
Can this be closed now?

Building with C++ works, because it's now required, not just optionally supported.
Comment 29 Andrew Pinski 2024-03-31 21:23:53 UTC
(In reply to Jonathan Wakely from comment #28)
> Can this be closed now?
> 
> Building with C++ works, because it's now required, not just optionally
> supported.

Plus a requirement of a C++11 compiler is needed so closing as fixed as it was fixed a long time ago.