Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check the impact of -fimplicit-constexpr #47239

Open
fwyzard opened this issue Feb 2, 2025 · 8 comments
Open

Check the impact of -fimplicit-constexpr #47239

fwyzard opened this issue Feb 2, 2025 · 8 comments

Comments

@fwyzard
Copy link
Contributor

fwyzard commented Feb 2, 2025

From the GCC 12 manual:

-fimplicit-constexpr

Make inline functions implicitly constexpr, if they satisfy the requirements for a constexpr function. This option can be used in C++14 mode or later. This can result in initialization changing from dynamic to static and other optimizations.

We could try using in CMSSW 🤷🏻

@fwyzard
Copy link
Contributor Author

fwyzard commented Feb 2, 2025

assign core

@cmsbuild
Copy link
Contributor

cmsbuild commented Feb 2, 2025

New categories assigned: core

@Dr15Jones,@makortel,@smuzaffar you have been requested to review this Pull request/Issue and eventually sign? Thanks

@cmsbuild
Copy link
Contributor

cmsbuild commented Feb 2, 2025

cms-bot internal usage

@cmsbuild
Copy link
Contributor

cmsbuild commented Feb 2, 2025

A new Issue was created by @fwyzard.

@Dr15Jones, @antoniovilela, @makortel, @mandrenguyen, @rappoccio, @sextonkennedy, @smuzaffar can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@makortel
Copy link
Contributor

makortel commented Feb 2, 2025

Found this https://www.mail-archive.com/[email protected]/msg274264.html as more background (in short, the writer foresees constexpr to have similar fate as the register keyword).

Found also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110127 that reports "extremely slow and memory intensive compilation". IIUC the problem is fixed in 13.3, but apparently 12.X (at least X=1, 3) would be impacted.

@fwyzard
Copy link
Contributor Author

fwyzard commented Feb 2, 2025

Thanks for digging !

the writer foresees constexpr to have similar fate as the register keyword

I kind of agree.
Can one even have non-inline constexpr functions?
Maybe they could be used by the LTO ?
Anyway.

IIUC the problem is fixed in 13.3, but apparently 12.X (at least X=1, 3) would be impacted.

Good catch.
I guess we can give it a try in the GCC 13 builds, then.

@makortel
Copy link
Contributor

makortel commented Feb 2, 2025

Can one even have non-inline constexpr functions?

No, from https://en.cppreference.com/w/cpp/language/constexpr

A constexpr specifier used in the first declaration of a function (or static data member(since C++17)) implies inline.

@fwyzard
Copy link
Contributor Author

fwyzard commented Feb 2, 2025

OK, and a constexpr function cannot just be declared (and defined in a different translation unit):

error: ‘constexpr int f()’ used before its definition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants