Skip to content

Fix GCC6 compilation error in count_digits - #3340

Closed
glebm wants to merge 1 commit into
fmtlib:masterfrom
diasurgical:9.1.0-gcc6
Closed

glebm wants to merge 1 commit into
fmtlib:masterfrom
diasurgical:9.1.0-gcc6

Conversation

@glebm

@glebm glebm commented Mar 12, 2023

Copy link
Copy Markdown
Contributor

GCC6 appears to need the explicit return type there.

Otherwise, it fails with:

error: use of 'fmt::v9::detail::count_digits(UInt)::<lambda(UInt)> [with int BITS = 4; UInt = long long unsigned int]' before deduction of 'auto'

Fixes #3339

GCC6 appears to need the explicit return type there.

Otherwise, it fails with:

> error: use of 'fmt::v9::detail::count_digits(UInt)::<lambda(UInt)> [with int BITS = 4; UInt = long long unsigned int]' before deduction of 'auto'
@vitaut

vitaut commented Mar 12, 2023

Copy link
Copy Markdown
Contributor

Could you provide a godbolt repro?

@glebm

glebm commented Mar 12, 2023

Copy link
Copy Markdown
Contributor Author

Do you have a godbolt template with libfmt that I can use?

@glebm

glebm commented Mar 12, 2023

Copy link
Copy Markdown
Contributor Author

Note that I encountered this using a somewhat esoteric fork of GCC (Amiga GCC).
The full compilation error is available in the linked issue.

@vitaut

vitaut commented Mar 12, 2023

Copy link
Copy Markdown
Contributor

You could use this as a starting point: https://godbolt.org/z/b4TEMh5s4.

@glebm

glebm commented Mar 12, 2023

Copy link
Copy Markdown
Contributor Author

There does not appear to be any version of GCC 6.5.x on godbolt

@glebm

glebm commented Mar 12, 2023

Copy link
Copy Markdown
Contributor Author

Note that the error happens during compilation of fmt itself

@glebm

glebm commented Mar 12, 2023

Copy link
Copy Markdown
Contributor Author

Godbolt: https://godbolt.org/z/8Wx1PxPss

image

I think the issue is simply a symptom of #3341. It is not reproducible on master, where #3341 is fixed by #3066.

It only results in a much shorter error message when #3341 is present. Please close the PR if that doesn't seem worth it.

@vitaut

vitaut commented Mar 12, 2023

Copy link
Copy Markdown
Contributor

Closing then but thanks for investigation.

@sergiud

sergiud commented Sep 4, 2023

Copy link
Copy Markdown
Contributor

I observe the issue again using fmt 10.1.1 and GCC 6.4.0. fmt 10.1.0 worked just fine. Regression?

The issue also only occurs in debug mode but not in release.

Log

Bisect points to 6c845f5 as the breaking commit. /cc @elbeno

@vitaut

vitaut commented Sep 4, 2023

Copy link
Copy Markdown
Contributor

Could you provide a godbolt repro? I wasn't able to reproduce the issue in https://godbolt.org/z/bbs165G9f.

@sergiud

sergiud commented Sep 4, 2023

Copy link
Copy Markdown
Contributor

Sure: https://godbolt.org/z/9c8c895Wo. Important bit is -DFMT_HEADER_ONLY=1 which triggers the errors also in your repro.

@vitaut

vitaut commented Sep 4, 2023

Copy link
Copy Markdown
Contributor

Looks like a gcc 6 bug. Worked around in 84e6661.

@KaganCanSit

KaganCanSit commented Mar 25, 2024

Copy link
Copy Markdown
Contributor

Hi @vitaut,

gabime/spdlog#3050
As I mentioned in the error above, I get the same error in gcc 9.4.1 for the main version and the current version.

I tested the release version with different gccs on spdn. It is as in the attachment. If I have free time, I will try master branch version.

I would like to help you resolve this error.

@vitaut

vitaut commented Mar 29, 2024

Copy link
Copy Markdown
Contributor

@KaganCanSit if it happens on master please open a separate issue and provide a self-contained repro.

@KaganCanSit

Copy link
Copy Markdown
Contributor

Hello @vitaut,
Today, I took the fmt library from the master tree and compiled it in the following gcc versions. I haven't received any errors so far.

GCC Versions:
7.5.0
7.1
6.5.0
5.5.0
5.1
4.9
4.8.5
4.8.4

When I compiled the spdlog by updating the header files in the spdlog, I received an error. Looks like a little more time is needed here. A cleaner operation may occur after Fmt is released and spdlog implements this version.

I wanted to give information. See you later.

@KaganCanSit

KaganCanSit commented Dec 24, 2024

Copy link
Copy Markdown
Contributor

Hello again @vitaut,
After checking the spdlog update, I got this error in g++/gcc 4.8.1. The compiler does not fully support lambda expressions. I have made various issue reports and tests regarding this situation.

After deciding on this situation, it may be necessary to change the following statement in the documentation.

"The library is highly portable and requires only a minimal subset of C++11 features which are available in GCC 4.8, Clang 3.4, MSVC 19.0 (2015) and later. Newer compiler and standard library features are used if available, and enable additional functionality."

gabime/spdlog#3050

I would like to help with this issue.

@vitaut

vitaut commented Dec 24, 2024

Copy link
Copy Markdown
Contributor

The docs have already been updated:

GCC 4.9, Clang 3.4, MSVC 19.10 (2017) and later

https://fmt.dev/dev/

@KaganCanSit

KaganCanSit commented Dec 24, 2024

Copy link
Copy Markdown
Contributor

@vitaut Ohh, I missed it. I'm focusing on the readme and repository URL. The link to "https://fmt.dev/11.0/" is out of date. It might be confusing since the same thing exists in version 11.0. Maybe we update this partitions.

image
image

@vitaut

vitaut commented Dec 25, 2024

Copy link
Copy Markdown
Contributor

We don't retroactively changed published docs.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v9.1.0 gcc 6 compilation error: use of 'fmt::v9::detail::count_digits` before deduction of 'auto'

4 participants