public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/111653] New: make bootstrap4 fails for -fchecking=2 code generation changes
@ 2023-10-01 13:01 slyfox at gcc dot gnu.org
  2023-10-04  9:27 ` [Bug bootstrap/111653] " rguenth at gcc dot gnu.org
  2023-11-01 21:12 ` slyfox at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-10-01 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111653
           Summary: make bootstrap4 fails for -fchecking=2 code generation
                    changes
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Reproducer on current gcc master from r14-4353-gf416a3fdbee32a:

    $ ~/dev/git/gcc/configure --disable-multilib --enable-languages=c,c++
CC='gcc -O2' CXX='g++ -O2'
    $ make bootstrap4
    ...
    Comparing stages 3 and 4
    Bootstrap comparison failure!
    x86_64-pc-linux-gnu/libstdc++-v3/src/filesystem/dir.o differs
    x86_64-pc-linux-gnu/libstdc++-v3/src/filesystem/cow-dir.o differs
    x86_64-pc-linux-gnu/libstdc++-v3/src/c++20/tzdb.o differs
    x86_64-pc-linux-gnu/libstdc++-v3/src/c++17/cow-fs_path.o differs
    x86_64-pc-linux-gnu/libstdc++-v3/src/c++17/fs_path.o differs
    x86_64-pc-linux-gnu/libstdc++-v3/src/c++17/cow-fs_dir.o differs
    x86_64-pc-linux-gnu/libstdc++-v3/src/c++17/fs_dir.o differs

The failure happens due to the difference between stage3 and stage4 flags:
- stage3: -fchecking=1
- stage4: no flag (debug version implies -fchecking=2 due to
`ac_checking_flags=yes,extra` non-release defaults)

Som thoughts:
1. gcc manual says it's fine to see minor code geneation changes on
-fchecking=2.
2. there are only 7 files with code generation difference
3. -fchecking=2 detects real bugs like PR111647

It feels like depending on [1.] being a bug or a feature there are a few
possible solutions:
a) fix -fchecking=2 instability and change manual to always guarantee that
-fchecking=2 does not change code
b) if a) is infeasible then stop using -fchecking=2 for stage compares, say to
disable do-compare3 entirely
c) declate 4-stage bootstrap incompatible with `extra` checking flags
d) something else?

WDYT?

Minimal example with -fchecking= instability:

$ cat fs_dir.cc.cc
namespace std {

struct type_info {
  void operator==(const type_info &) const;
};
struct _Sp_counted_base {
  virtual void _M_get_deleter(const type_info &);
};
struct _Sp_make_shared_tag {};
template <typename> struct _Sp_counted_ptr_inplace : _Sp_counted_base {
  struct _Impl {
    _Impl(int);
  };
  _Sp_counted_ptr_inplace(int __a) : _M_impl(__a) {}
  void _M_get_deleter(const type_info &__ti) {
    __ti == typeid(_Sp_make_shared_tag);
  }
  _Impl _M_impl;
};
struct __shared_count {
  __shared_count() { _Sp_counted_ptr_inplace<int>(0); }
} _M_refcount;
} // namespace std


$ g++ -frandom-seed=fs_dir.lo -c fs_dir.cc.cc -fchecking=2 -o bug.o
$ sha1sum bug.o
92d676d60ee6e26e9b242fb64bffe9e47a92052a  bug.o

$ /g++ -frandom-seed=fs_dir.lo -c fs_dir.cc.cc -fchecking=2 -o bug.o
-fchecking=1
$ sha1sum bug.o
748b578657a335c212872b012b2afaf0be3ecbc4  bug.o

Note: hashes are different.

$ stage4-gcc/xgcc -Bstage4-gcc -v
Reading specs from stage4-gcc/specs
COLLECT_GCC=stage4-gcc/xgcc
COLLECT_LTO_WRAPPER=stage4-gcc/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/slyfox/dev/git/gcc/configure --disable-multilib
--enable-languages=c,c++ CC='gcc -O2' CXX='g++ -O2'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230929 (experimental) (GCC)

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

* [Bug bootstrap/111653] make bootstrap4 fails for -fchecking=2 code generation changes
  2023-10-01 13:01 [Bug bootstrap/111653] New: make bootstrap4 fails for -fchecking=2 code generation changes slyfox at gcc dot gnu.org
@ 2023-10-04  9:27 ` rguenth at gcc dot gnu.org
  2023-11-01 21:12 ` slyfox at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-04  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
IMHO we should try harder to make -fchecking=2 _not_ generate different code.

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

* [Bug bootstrap/111653] make bootstrap4 fails for -fchecking=2 code generation changes
  2023-10-01 13:01 [Bug bootstrap/111653] New: make bootstrap4 fails for -fchecking=2 code generation changes slyfox at gcc dot gnu.org
  2023-10-04  9:27 ` [Bug bootstrap/111653] " rguenth at gcc dot gnu.org
@ 2023-11-01 21:12 ` slyfox at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-11-01 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

Sergei Trofimovich <slyfox at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
The difference on the minimized example from #comment1 disappeared with
r14-4793-gdad311874ac3b3 "c++: remove NON_DEPENDENT_EXPR, part 1".

On r14-5058-g25f92179dea308 I don't get comparison failures on 'make
bootstrap4' anymore. Let's close it as FIXED.

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

end of thread, other threads:[~2023-11-01 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-01 13:01 [Bug bootstrap/111653] New: make bootstrap4 fails for -fchecking=2 code generation changes slyfox at gcc dot gnu.org
2023-10-04  9:27 ` [Bug bootstrap/111653] " rguenth at gcc dot gnu.org
2023-11-01 21:12 ` slyfox at gcc dot gnu.org

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).