Bug 81244 - Odd things happening with always_inline on 32bit
Summary: Odd things happening with always_inline on 32bit
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 7.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL: https://bugs.freedesktop.org/show_bug...
Depends on:
Reported: 2017-06-28 23:58 UTC by Timothy Arceri
Modified: 2019-10-09 02:36 UTC (History)
0 users

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2017-06-29 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Arceri 2017-06-28 23:58:49 UTC

When running an OpenGL regression test against a recent change in Mesa git which uses always_inline, we are getting odd results. 64bit builds seem to be working fine, it's just 32bit with a problem.

gcc 6.3.1 and gcc 7.1 have both been confirmed to have the same issue.

If I remove always_inline the problem goes away.


always_inline was added in this commit [1], but it wasn't until a second user of the inlined function was added that the problem began [2]. 

[1] https://cgit.freedesktop.org/mesa/mesa/commit/?id=ca5f1e82de7e43eecb00843597688801809cc22e
[2] https://cgit.freedesktop.org/mesa/mesa/commit/?id=bc0af44a5ae9a6671cc6c2f5a380d86fd7babacb


I've only tested the issue on Intel gpu's so far, but likely exists on all drivers. It should be reproducible on Sandy Bridge and later. 

1. Build the a 32 versions of piglit [1] and mesa [2] from git.
2. Set LD_LIBRARY_PATH to the new Mesa libs and run the following tests from the piglit git directory.

  ./bin/shader_runner tests/spec/arb_shader_bit_encoding/execution/and-clamp.shader_test -auto -fbo

If you have any questions about this please ask for help on the #dri-devel or #intel-gfx freenode channels. My nick is tarceri but there should be someone who can help if I'm not around.

[1] git://anongit.freedesktop.org/piglit
[2] git://anongit.freedesktop.org/mesa/mesa
Comment 1 Timothy Arceri 2017-06-28 23:59:37 UTC
Adding url to Mesa bug report.
Comment 2 Andrew Pinski 2017-06-29 00:27:23 UTC
This sounds like maybe some undefined code that only shows up with always_inline and maybe 32bit x86.
Can you attach the preprocessed source of where the always_inline makes a difference?
Also can you try with -fwarpv (turns signed integer overflow to be defined as overflow) -fno-strict-aliasing (turns aliasing issues from undefined to being defined)?
Comment 3 Timothy Arceri 2017-06-29 01:53:04 UTC
No change with -fno-strict-aliasing

-fwarpv is not geting past config with warnings such as:

   WARNING: sys/sysmacros.h: present but cannot be compiled
Comment 4 Timothy Arceri 2019-10-09 02:36:15 UTC
Seems to work correctly with newer versions of GCC.