public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* testsuite requires LTO?
@ 2022-04-11 23:51 Steve Kargl
  2022-04-12  7:07 ` Richard Biener
  2022-04-12  7:41 ` Andreas Schwab
  0 siblings, 2 replies; 7+ messages in thread
From: Steve Kargl @ 2022-04-11 23:51 UTC (permalink / raw)
  To: gcc

If I configure gcc with the following

../gccx/configure --prefix=$HOME/work/x --enable-languages=c,c++,fortran \
  --enable-bootstrap --disable-nls --enable-checking --disable-multilib \
  --disable-libsanitizer --disable-lto.

then bootstrap gcc, why do I see 1000s of failures with

% cd gcc
% gmake -j7 check-c
...
FAIL: gcc.dg/torture/pr64365.c   -O2 -flto  (test for excess errors)
FAIL: gcc.dg/torture/pr61786.c   -O2 -flto  (test for excess errors)
FAIL: gcc.dg/torture/pr63380-2.c   -O2 -flto  (test for excess errors)
FAIL: gcc.dg/torture/pr65270-2.c   -O2 -flto  (test for excess errors)

Should the testsuite recognize that gcc is built without LTO support?

-- 
Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: testsuite requires LTO?
  2022-04-11 23:51 testsuite requires LTO? Steve Kargl
@ 2022-04-12  7:07 ` Richard Biener
  2022-04-12  7:26   ` Richard Biener
  2022-04-12  7:41 ` Andreas Schwab
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Biener @ 2022-04-12  7:07 UTC (permalink / raw)
  To: Steve Kargl; +Cc: GCC Development

On Tue, Apr 12, 2022 at 1:53 AM Steve Kargl via Gcc <gcc@gcc.gnu.org> wrote:
>
> If I configure gcc with the following
>
> ../gccx/configure --prefix=$HOME/work/x --enable-languages=c,c++,fortran \
>   --enable-bootstrap --disable-nls --enable-checking --disable-multilib \
>   --disable-libsanitizer --disable-lto.
>
> then bootstrap gcc, why do I see 1000s of failures with
>
> % cd gcc
> % gmake -j7 check-c
> ...
> FAIL: gcc.dg/torture/pr64365.c   -O2 -flto  (test for excess errors)
> FAIL: gcc.dg/torture/pr61786.c   -O2 -flto  (test for excess errors)
> FAIL: gcc.dg/torture/pr63380-2.c   -O2 -flto  (test for excess errors)
> FAIL: gcc.dg/torture/pr65270-2.c   -O2 -flto  (test for excess errors)
>
> Should the testsuite recognize that gcc is built without LTO support?

Yes, it does, in testsuite/lib/gcc-dg.exp

if [info exists TORTURE_OPTIONS] {
    set DG_TORTURE_OPTIONS $TORTURE_OPTIONS
} else {
    # It is theoretically beneficial to group all of the O2/O3 options together,
    # as in many cases the compiler will generate identical executables for
    # all of them--and the c-torture testsuite will skip testing identical
    # executables multiple times.
    # Also note that -finline-functions is explicitly included in one of the
    # items below, even though -O3 is also specified, because some ports may
    # choose to disable inlining functions by default, even when optimizing.
    set DG_TORTURE_OPTIONS [list \
        { -O0 } \
        { -O1 } \
        { -O2 } \
        { -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops
-ftracer -finline-functions } \
        { -O3 -g } \
        { -Os } ]

    if [check_effective_target_lto] {
        # When having plugin test both slim and fat LTO and plugin/nonplugin
        # path.
        if [check_linker_plugin_available] {
           set LTO_TORTURE_OPTIONS [list \
              { -O2 -flto -fno-use-linker-plugin -flto-partition=none } \
              { -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects }
           ]
        } else {
           set LTO_TORTURE_OPTIONS [list \
              { -O2 -flto -flto-partition=none } \
              { -O2 -flto }
           ]
        }

so either TORTURE_OPTIONS is set or check_effective_target_lto doesn't work.
The check does simply

    return [check_no_compiler_messages lto object {
        void foo (void) { }
    } "-flto"]

so I wonder what your excess errors are?  The check above should also
leave traces
in the testsuite log.  It might be that --disable-lto doesn't disable
gcc -c -flto but just
disables lto1 building though.

>
> --
> Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: testsuite requires LTO?
  2022-04-12  7:07 ` Richard Biener
@ 2022-04-12  7:26   ` Richard Biener
  2022-04-12 17:30     ` Steve Kargl
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Biener @ 2022-04-12  7:26 UTC (permalink / raw)
  To: Steve Kargl; +Cc: GCC Development

On Tue, Apr 12, 2022 at 9:07 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Tue, Apr 12, 2022 at 1:53 AM Steve Kargl via Gcc <gcc@gcc.gnu.org> wrote:
> >
> > If I configure gcc with the following
> >
> > ../gccx/configure --prefix=$HOME/work/x --enable-languages=c,c++,fortran \
> >   --enable-bootstrap --disable-nls --enable-checking --disable-multilib \
> >   --disable-libsanitizer --disable-lto.
> >
> > then bootstrap gcc, why do I see 1000s of failures with
> >
> > % cd gcc
> > % gmake -j7 check-c
> > ...
> > FAIL: gcc.dg/torture/pr64365.c   -O2 -flto  (test for excess errors)
> > FAIL: gcc.dg/torture/pr61786.c   -O2 -flto  (test for excess errors)
> > FAIL: gcc.dg/torture/pr63380-2.c   -O2 -flto  (test for excess errors)
> > FAIL: gcc.dg/torture/pr65270-2.c   -O2 -flto  (test for excess errors)
> >
> > Should the testsuite recognize that gcc is built without LTO support?
>
> Yes, it does, in testsuite/lib/gcc-dg.exp
>
> if [info exists TORTURE_OPTIONS] {
>     set DG_TORTURE_OPTIONS $TORTURE_OPTIONS
> } else {
>     # It is theoretically beneficial to group all of the O2/O3 options together,
>     # as in many cases the compiler will generate identical executables for
>     # all of them--and the c-torture testsuite will skip testing identical
>     # executables multiple times.
>     # Also note that -finline-functions is explicitly included in one of the
>     # items below, even though -O3 is also specified, because some ports may
>     # choose to disable inlining functions by default, even when optimizing.
>     set DG_TORTURE_OPTIONS [list \
>         { -O0 } \
>         { -O1 } \
>         { -O2 } \
>         { -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops
> -ftracer -finline-functions } \
>         { -O3 -g } \
>         { -Os } ]
>
>     if [check_effective_target_lto] {
>         # When having plugin test both slim and fat LTO and plugin/nonplugin
>         # path.
>         if [check_linker_plugin_available] {
>            set LTO_TORTURE_OPTIONS [list \
>               { -O2 -flto -fno-use-linker-plugin -flto-partition=none } \
>               { -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects }
>            ]
>         } else {
>            set LTO_TORTURE_OPTIONS [list \
>               { -O2 -flto -flto-partition=none } \
>               { -O2 -flto }
>            ]
>         }
>
> so either TORTURE_OPTIONS is set or check_effective_target_lto doesn't work.
> The check does simply
>
>     return [check_no_compiler_messages lto object {
>         void foo (void) { }
>     } "-flto"]
>
> so I wonder what your excess errors are?  The check above should also
> leave traces
> in the testsuite log.  It might be that --disable-lto doesn't disable
> gcc -c -flto but just
> disables lto1 building though.

I checked and it works fine for me, --disable-lto disables LTO support
and  there's
no extra FAILs in dg-torture.exp.  The testsuite log has

Executing on host: /tmp/obj/gcc/xgcc -B/tmp/obj/gcc/
-fdiagnostics-plain-output  -flto -c -o lto10207.o lto10207.c
(timeout = 300)
spawn -ignore SIGHUP /tmp/obj/gcc/xgcc -B/tmp/obj/gcc/
-fdiagnostics-plain-output -flto -c -o lto10207.o lto10207.c^M
cc1: error: LTO support has not been enabled in this configuration^M
compiler exited with status 1

which causes no -flto to be used.

Richard.

>
> >
> > --
> > Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: testsuite requires LTO?
  2022-04-11 23:51 testsuite requires LTO? Steve Kargl
  2022-04-12  7:07 ` Richard Biener
@ 2022-04-12  7:41 ` Andreas Schwab
  1 sibling, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2022-04-12  7:41 UTC (permalink / raw)
  To: Steve Kargl via Gcc; +Cc: sgk

On Apr 11 2022, Steve Kargl via Gcc wrote:

> Should the testsuite recognize that gcc is built without LTO support?

Yes, we have check_effective_target_lto for that.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: testsuite requires LTO?
  2022-04-12  7:26   ` Richard Biener
@ 2022-04-12 17:30     ` Steve Kargl
  2022-04-12 17:42       ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Steve Kargl @ 2022-04-12 17:30 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Development

On Tue, Apr 12, 2022 at 09:26:58AM +0200, Richard Biener wrote:
> On Tue, Apr 12, 2022 at 9:07 AM Richard Biener
> <richard.guenther@gmail.com> wrote:
> >
> > On Tue, Apr 12, 2022 at 1:53 AM Steve Kargl via Gcc <gcc@gcc.gnu.org> wrote:
> > >
> > > If I configure gcc with the following
> > >
> > > ../gccx/configure --prefix=$HOME/work/x --enable-languages=c,c++,fortran \
> > >   --enable-bootstrap --disable-nls --enable-checking --disable-multilib \
> > >   --disable-libsanitizer --disable-lto.
> > >
> > > then bootstrap gcc, why do I see 1000s of failures with
> > >
> > > % cd gcc
> > > % gmake -j7 check-c
> > > ...
> > > FAIL: gcc.dg/torture/pr64365.c   -O2 -flto  (test for excess errors)
> > > FAIL: gcc.dg/torture/pr61786.c   -O2 -flto  (test for excess errors)
> > > FAIL: gcc.dg/torture/pr63380-2.c   -O2 -flto  (test for excess errors)
> > > FAIL: gcc.dg/torture/pr65270-2.c   -O2 -flto  (test for excess errors)
> > >
> > > Should the testsuite recognize that gcc is built without LTO support?
> >
> > Yes, it does, in testsuite/lib/gcc-dg.exp
> >
> > if [info exists TORTURE_OPTIONS] {
> >     set DG_TORTURE_OPTIONS $TORTURE_OPTIONS
> > } else {
> >     # It is theoretically beneficial to group all of the O2/O3 options together,
> >     # as in many cases the compiler will generate identical executables for
> >     # all of them--and the c-torture testsuite will skip testing identical
> >     # executables multiple times.
> >     # Also note that -finline-functions is explicitly included in one of the
> >     # items below, even though -O3 is also specified, because some ports may
> >     # choose to disable inlining functions by default, even when optimizing.
> >     set DG_TORTURE_OPTIONS [list \
> >         { -O0 } \
> >         { -O1 } \
> >         { -O2 } \
> >         { -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops
> > -ftracer -finline-functions } \
> >         { -O3 -g } \
> >         { -Os } ]
> >
> >     if [check_effective_target_lto] {
> >         # When having plugin test both slim and fat LTO and plugin/nonplugin
> >         # path.
> >         if [check_linker_plugin_available] {
> >            set LTO_TORTURE_OPTIONS [list \
> >               { -O2 -flto -fno-use-linker-plugin -flto-partition=none } \
> >               { -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects }
> >            ]
> >         } else {
> >            set LTO_TORTURE_OPTIONS [list \
> >               { -O2 -flto -flto-partition=none } \
> >               { -O2 -flto }
> >            ]
> >         }
> >
> > so either TORTURE_OPTIONS is set or check_effective_target_lto doesn't work.
> > The check does simply
> >
> >     return [check_no_compiler_messages lto object {
> >         void foo (void) { }
> >     } "-flto"]
> >
> > so I wonder what your excess errors are?  The check above should also
> > leave traces
> > in the testsuite log.  It might be that --disable-lto doesn't disable
> > gcc -c -flto but just
> > disables lto1 building though.
> 
> I checked and it works fine for me, --disable-lto disables LTO support
> and  there's
> no extra FAILs in dg-torture.exp.  The testsuite log has
> 
> Executing on host: /tmp/obj/gcc/xgcc -B/tmp/obj/gcc/
> -fdiagnostics-plain-output  -flto -c -o lto10207.o lto10207.c
> (timeout = 300)
> spawn -ignore SIGHUP /tmp/obj/gcc/xgcc -B/tmp/obj/gcc/
> -fdiagnostics-plain-output -flto -c -o lto10207.o lto10207.c^M
> cc1: error: LTO support has not been enabled in this configuration^M
> compiler exited with status 1
> 
> which causes no -flto to be used.
> 

Well, I determined what the problem is.  On FreeBSD,
GNU make is gmake.  make(1) on FreeBSD is BSD make.

% gmake -j7 check-c

Does not pass down the name of the invoking command 
to sub-make jobs.  4000+ FAILs had the form

make[2]: illegal argument to -j -- must be positive integer!
FAIL ...

Well, that's an error message from BSD make.  If I do 

% setenv MAKE gmake
% gmake -j7 check-c

4000+ FAILS disappear, so it's good that he environmental
variable MAKE is honored.  I know in the past I did not
need to sete MAKE.

With LTO disabled and MAKE set, I see

                === gcc Summary ===

# of expected passes            175408
# of unexpected failures        1078
# of unexpected successes       20
# of expected failures          1459
# of unresolved testcases       10
# of unsupported tests          3248
/usr/home/sgk/gcc/objx/gcc/xgcc  version 12.0.1 20220411 (experimental) (GCC) 

-- 
Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: testsuite requires LTO?
  2022-04-12 17:30     ` Steve Kargl
@ 2022-04-12 17:42       ` Jonathan Wakely
  2022-04-12 18:03         ` Steve Kargl
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2022-04-12 17:42 UTC (permalink / raw)
  To: Steve Kargl; +Cc: Richard Biener, GCC Development

On Tue, 12 Apr 2022 at 18:32, Steve Kargl wrote:
> Well, I determined what the problem is.  On FreeBSD,
> GNU make is gmake.  make(1) on FreeBSD is BSD make.
>
> % gmake -j7 check-c
>
> Does not pass down the name of the invoking command
> to sub-make jobs.

That suggests some makefile is using 'make' directly, not using
$(MAKE). But if that was the case, then setting MAKE in the
environment wouldn't help either.

What version of gmake do you have?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: testsuite requires LTO?
  2022-04-12 17:42       ` Jonathan Wakely
@ 2022-04-12 18:03         ` Steve Kargl
  0 siblings, 0 replies; 7+ messages in thread
From: Steve Kargl @ 2022-04-12 18:03 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Richard Biener, GCC Development

On Tue, Apr 12, 2022 at 06:42:20PM +0100, Jonathan Wakely wrote:
> On Tue, 12 Apr 2022 at 18:32, Steve Kargl wrote:
> > Well, I determined what the problem is.  On FreeBSD,
> > GNU make is gmake.  make(1) on FreeBSD is BSD make.
> >
> > % gmake -j7 check-c
> >
> > Does not pass down the name of the invoking command
> > to sub-make jobs.
> 
> That suggests some makefile is using 'make' directly, not using
> $(MAKE). But if that was the case, then setting MAKE in the
> environment wouldn't help either.
> 
> What version of gmake do you have?

% gmake --version
GNU Make 4.3
Built for amd64-portbld-freebsd13.0

It's the version from FreeBSD port collection.

I just started a new bootstrap with LTO enabled
without any patches in my gcc tree to try to get
a baseline.  It will take a bit.

-- 
Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-12 18:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 23:51 testsuite requires LTO? Steve Kargl
2022-04-12  7:07 ` Richard Biener
2022-04-12  7:26   ` Richard Biener
2022-04-12 17:30     ` Steve Kargl
2022-04-12 17:42       ` Jonathan Wakely
2022-04-12 18:03         ` Steve Kargl
2022-04-12  7:41 ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).