https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577

--- Comment #153 from Peter Bisroev <peter.bisroev at groundlabs dot com> ---
Hi Everyone, just wanted to give you an update on where I am at the moment.

Unfortunately I did not have much time to dig into this more, but last night
while trying to figure out what is causing those ICEs at the end of stage1 I
noticed something interesting.

All of the below is in reference to gcc 8.3.0 being bootstrapped with 4.7.4.
8.3.0 is patched with the patches from comment#72 and comment #63 as suggested
by Dave and EML. Technically these are the subset of the patches provided by
the The Written Word. However using the rest of patches from The Written Word's
patch set did not seem to make a difference in my testing so far so I am trying
to keep the changes to the minimum for the moment (please let me know if this
is a wrong approach).

We already know that we currently cannot compile stage1 with -O0 as it causes
binaries to become huge and we get PCREL21B errors that were already described
here from HP's linker. If I compile stage1 with -Os or -O2, I get ICEs at the
end of stage1 from cc1 during selftesting. I will look into this more,
hopefully tonight, 'make selftest-gdb' is really convenient here.

However while digging around selftesting, I noticed if I compile stage1 with
-O1, self tests pass without issues. Furthermore, if I run the self test build
command:
----------
/home/pbisroev/src/build/./gcc/xgcc \
  -B/home/pbisroev/src/build-O1/./gcc/ \
  -xc -nostdinc /dev/null -S -o /dev/null \
  -fself-test=/home/pbisroev/src/gcc-8.3.0/gcc/testsuite/selftests
----------
With any optimization flag, -O[s012], all self tests pass as long as -O1 is set
in STAGE1_CFLAGS. If I then further restrict optimization to -O1 to libraries
as well (at least from how it appears to work now), build fails at 'Configuring
stage 1 in ia64-hp-hpux11.31/libgcc' while trying to test compile something
simple as below:
----------
/* confdefs.h */
#define PACKAGE_NAME "GNU C Runtime Library"
#define PACKAGE_TARNAME "libgcc"
#define PACKAGE_VERSION "1.0"
#define PACKAGE_STRING "GNU C Runtime Library 1.0"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL "http://www.gnu.org/software/libgcc/";
/* end confdefs.h.  */

int
main ()
{

  ;
  return 0;
}
----------

However the above can be compiled with -O0 with the same compiler. So I changed
my build line to use -O0 as well:
----------
gmake \
  STAGE1_CFLAGS="-D_XOPEN_SOURCE_EXTENDED -g -O1" \
  STAGE1_CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED -g -O1" \
  STAGE1_TFLAGS='-g -O0 -D_XOPEN_SOURCE_EXTENDED' \
  BOOT_CFLAGS='-g -O0 -D_XOPEN_SOURCE_EXTENDED' \
  CFLAGS_FOR_TARGET='-g -O0 -D_XOPEN_SOURCE_EXTENDED' bootstrap
----------

And now I get much further, specifically the error I get is
----------
/home/pbisroev/src/build/./gcc/xgcc -shared-libgcc
-B/home/pbisroev/src/build/./gcc -nostdinc++
-L/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/src
-L/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/src/.libs
-L/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/libsupc++/.libs
-B/home/pbisroev/local/aCC/32/gcc-8.3.0/ia64-hp-hpux11.31/bin/
-B/home/pbisroev/local/aCC/32/gcc-8.3.0/ia64-hp-hpux11.31/lib/ -isystem
/home/pbisroev/local/aCC/32/gcc-8.3.0/ia64-hp-hpux11.31/include -isystem
/home/pbisroev/local/aCC/32/gcc-8.3.0/ia64-hp-hpux11.31/sys-include   -g -O0
-D_XOPEN_SOURCE_EXTENDED -x c++-header -nostdinc++ -g -O2 -I
/home/pbisroev/local/aCC/32/include 
-I/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/ia64-hp-hpux11.31
-I/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include
-I/home/pbisroev/src/gcc-8.3.0/libstdc++-v3/libsupc++  -O2 -g -std=gnu++0x
/home/pbisroev/src/gcc-8.3.0/libstdc++-v3/include/precompiled/stdc++.h \
-o ia64-hp-hpux11.31/bits/stdc++.h.gch/O2ggnu++0x.gch
In file included from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/ios:41,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/istream:38,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/sstream:38,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/complex:45,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/ccomplex:39,
                 from
/home/pbisroev/src/gcc-8.3.0/libstdc++-v3/include/precompiled/stdc++.h:52:
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/localefwd.h:113:34:
error: macro "isblank" passed 2 arguments, but takes just 1
     isblank(_CharT, const locale&);

...

In file included from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/basic_ios.h:37,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/ios:44,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/istream:38,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/sstream:38,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/complex:45,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/ccomplex:39,
                 from
/home/pbisroev/src/gcc-8.3.0/libstdc++-v3/include/precompiled/stdc++.h:52:
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/locale_facets.h:2644:36:
error: expected primary-expression before '>' token
     { return use_facet<ctype<_CharT> >(__loc).toupper(__c); }
                                    ^
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/locale_facets.h:2644:38:
error: expected primary-expression before '>' token
     { return use_facet<ctype<_CharT> >(__loc).toupper(__c); }
                                      ^
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/locale_facets.h:2644:47:
error: request for member 'toupper' in '__loc', which is of non-class type
'const int'
     { return use_facet<ctype<_CharT> >(__loc).toupper(__c); }
                                               ^~~~~~~
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/locale_facets.h:
At global scope:
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/locale_facets.h:2649:31:
error: 'locale' does not name a type; did you mean 'localtime'?
     tolower(_CharT __c, const locale& __loc)
                               ^~~~~~
                               localtime
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/locale_facets.h:
In function '_CharT tolower(_CharT, const int&)':
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/locale_facets.h:2650:14:
error: 'use_facet' was not declared in this scope
     { return use_facet<ctype<_CharT> >(__loc).tolower(__c); }
              ^~~~~~~~~
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/locale_facets.h:2650:14:
note: suggested alternative:
In file included from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/locale_classes.h:851,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/ios_base.h:41,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/ios:42,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/istream:38,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/sstream:38,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/complex:45,
                 from
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/ccomplex:39,
                 from
/home/pbisroev/src/gcc-8.3.0/libstdc++-v3/include/precompiled/stdc++.h:52:
/home/pbisroev/src/build/ia64-hp-hpux11.31/libstdc++-v3/include/bits/locale_classes.tcc:132:5:
note:   'std::use_facet'
     use_facet(const locale& __loc)
----------

So this is definitely some progress, and I am wondering how far that will get.
Has anyone seen these errors before? I will try to look into them more tonight.

As a side note, as suggested by The Written Word, I have tried to get 4.9.3 and
4.9.4 building, however I am having similar issues as described above with them
as well. So for the moment, as Dave suggested, using 4.7.4 for bootstrapping as
it seems to be OK based on the results of 'make check'.

Thank you everyone!
--peter

Reply via email to