Open Bug 1817565 Opened 2 years ago Updated 8 days ago

gcc-12 fails to inline a couple of always_inline functions in mozilla/mfbt/lz4/xxhash.h when -Og is specified

Categories

(Core :: MFBT, enhancement)

x86_64
Linux
enhancement

Tracking

()

Tracking Status
firefox112 --- affected

People

(Reporter: ishikawa, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I compile C-C Thunderbird under Debian GNU/Linux locally.

$ gcc-12 --version
gcc-12 (Debian 12.2.0-14) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

With the option "-Og", gcc-12 fails to inline two functions that are declared with
XXX_FORCED_INLINE:
XXH3_accumulate_512_sse2(), and
XXH3_scrambleAcc_sse2()

I am attaching the error log.

Without "-Og", compilation succeeds.
gcc-10 and gcc-11 did not have the problem.

If I comment out XXX_FORCE_INLINE for these two functions, gcc-12 compilation succeeds with -Og.

Blocks: build-gcc-12

Looking at https://github.com/Perl/perl5/issues/19776,
I thought the issue may be triggered due to "-Og" AND "-g" on the same command line.
But no, even if I remove all "-g" options from the command line, gcc-12 still fails to inline the two always_inline functions when -Og is specified.

I think this problem is related to the issue discussed in the following GCC bugzilla.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107931

So I reported my problem there.
It sound as if there is no remedy.
We may have to disable |always_inline| when the compiler is GCC 12 and -Og is specified on the command line.

(In reply to Robert Longson [:longsonr] from comment #3)

maybe report it to https://github.com/Cyan4973/xxHash

Thank you. Will do.

(In reply to ISHIKAWA, Chiaki from comment #4)

(In reply to Robert Longson [:longsonr] from comment #3)

maybe report it to https://github.com/Cyan4973/xxHash

Thank you. Will do.

Reported to the github.
https://github.com/Cyan4973/xxHash/issues/800

I am now sure now if GCC-10 and GCC-11 really inlined the functions because the gcc bugzilla mentions that sometimes errors were/are not reported in GCC. Oh well.

But for my local debugging purpose, getting TB compiled with -Og is more important than inlining these functions.

It seems that the issue was taken care of upstream.
Or I am using gcc-14 now and gcc-14 is smarter or more lenient than gcc-12.

I don't see the error any more (I think so. I build two versions of TB locally. One for valgrind testing using gcc, which unfortunately doesn't work very well, the other for ASAN test using clang. "-Og" is passed to valgrind version.)

GCC bug discussion at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107931
confirmed the existence of the issue (it is NOT a bug. It is a feature documented in GCC manual.), and it is a subtle issue.
It was made clear that gcc-10 and gcc-11 did not have this problem in the gcc bug report discussion.

I am not closing this yet since there will be someone starting to use gcc-12 thinking it is really mature and may get bitten by this issue.

According to GCC site ( https://gcc.gnu.org/ ) the following versions are officially supported versions.:
Supported Releases

GCC 14.2 (changes)
Status: 2024-07-11 (regression fixes & docs only).
GCC 13.3 (changes)
Status: 2024-04-30 (regression fixes & docs only).
GCC 12.4 (changes)
Status: 2024-06-20 (regression fixes & docs only).

Like I said I am using gcc-14.2 now.
I needed to apply some patches to compile the source code due to strange warnings/errors when I pass -Werror to catch as many dubious constructs as possible at compile-time in OTHER parts of the source code, but that is another story.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: