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

0.194 does not compile on ppc64/ppc64le linux #3157

Open
belegdol opened this Issue Jan 31, 2018 · 14 comments

Comments

Projects
None yet
6 participants
@belegdol
Copy link
Contributor

belegdol commented Jan 31, 2018

Hi all,
mame-0.194 Fedora package has failed to build [1][2] on ppc64 and ppc64le Fedora:

In file included from ../../../../../src/emu/emu.h:31:0:
../../../../../src/mame/drivers/fp200.cpp:28:36:   in constexpr expansion of 'operator""_MHz_XTAL(6.14399999999999999999999999999999e+0l)'
../../../../../src/emu/xtal.h:85:83: error: '(6.14399999999999999999999999999999e+0l * 1.0e+6l)' is not a constant expression
 constexpr XTAL operator ""_MHz_XTAL(long double clock) { return XTAL(double(clock * 1e6)); }
                                                                             ~~~~~~^~~~~
make[2]: *** [casio.make:362: ../../../../linux_gcc/obj/x64/Release/src/mame/drivers/fp200.o] Error 1
make[1]: *** [Makefile:463: casio] Error 2

The builds on s390x, i686, x86_64, aarch64 and armv7hl have completed successfully.
Best regards,
Julian
[1] https://koji.fedoraproject.org/koji/taskinfo?taskID=24590264
[2] https://koji.fedoraproject.org/koji/taskinfo?taskID=24590275

@felipesanches

This comment has been minimized.

Copy link
Contributor

felipesanches commented Jan 31, 2018

I guess you mean 0.194 ?

@belegdol belegdol changed the title 0.184 does not compile on ppc64/ppc64le linux 0.194 does not compile on ppc64/ppc64le linux Jan 31, 2018

@belegdol

This comment has been minimized.

Copy link
Contributor

belegdol commented Jan 31, 2018

Indeed, sorry - comment and title corrected

@galibert

This comment has been minimized.

Copy link
Member

galibert commented Jan 31, 2018

@belegdol

This comment has been minimized.

Copy link
Contributor

belegdol commented Jan 31, 2018

The drunk compiler is gcc-7.2.1 on both Fedora releases.

@galibert

This comment has been minimized.

Copy link
Member

galibert commented Jan 31, 2018

@cuavas

This comment has been minimized.

Copy link
Member

cuavas commented Jan 31, 2018

The long double type is a bit weird on PPC - it's a pair of double added together effectively, so you get an increase in precision but not range. You can also get strange effects if the two parts of the double don't line up neatly end-to-end. I suspect what's happening is that it's implicitly relying on a library function to multiply long double values, and the library function isn't constexpr qualified. I don't know what to do about it though - user-defined literal suffixes work on a very limited set of types.

@ajrhacker

This comment has been minimized.

Copy link
Contributor

ajrhacker commented Jan 31, 2018

It appears that constant expressions of the PPC long double type have been basically broken for over a decade in GCC, with no fix projected.

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

@galibert

This comment has been minimized.

Copy link
Member

galibert commented Jan 31, 2018

@ajrhacker

This comment has been minimized.

Copy link
Contributor

ajrhacker commented Jan 31, 2018

@galibert: As the OP shows, there are in fact long double overloads in our code now. These were Vas's doing, not yours.

@cuavas

This comment has been minimized.

Copy link
Member

cuavas commented Feb 1, 2018

Floating point user-defined literals need to use long double, so there's no way of avoiding it. I think --with-long-double-128 is default on ppc64/ppc64le so there's not much we can do about it on that side.

@belegdol

This comment has been minimized.

Copy link
Contributor

belegdol commented Feb 3, 2018

I added ExcludeArch for ppc64 and ppc64le for now, we may be able to get some help from Fedora's ppc team.

@classilla

This comment has been minimized.

Copy link

classilla commented Dec 16, 2018

The miscompile can be worked around by adding -mlong-double-64 to the compiler flags. This isn't ideal but appears to fix this specific problem. This gets the build further but there is another compilation issue at least on my ppc64le machine which I will try to spin up a PR for.

@classilla

This comment has been minimized.

Copy link

classilla commented Dec 16, 2018

(obviously -mlong-double-64 is only necessary for ppc64/ppc64le, it could be written into the platform code in the makefile)

@belegdol

This comment has been minimized.

Copy link
Contributor

belegdol commented Dec 29, 2018

Looks like in Fedora 30 at least ppc64le might start working again:
https://fedoraproject.org/wiki/Changes/PPC64LE_Float128_Transition

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