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

Build has strict-aliasing violations #8

Closed
eli-schwartz opened this issue Feb 29, 2024 · 9 comments
Closed

Build has strict-aliasing violations #8

eli-schwartz opened this issue Feb 29, 2024 · 9 comments
Assignees

Comments

@eli-schwartz
Copy link

make[1]: Entering directory '/var/tmp/portage/net-analyzer/argus-3.0.8.3-r2/work/argus-3.0.8.3/argus'
make[1]: warning: -j8 forced in submake: resetting jobserver mode.
x86_64-pc-linux-gnu-gcc -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -I. -I/usr/include -I./../include  -DHAVE_CONFIG_H  -c ArgusModeler.c
ArgusModeler.c: In function ‘ArgusGenerateRecord’:
ArgusModeler.c:3311:103: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
 3311 |                                  ((unsigned int *)(dsr + 1))[0] = (((unsigned int *)&metric->dst.pkts)[0]);
      |                                                                                                       ^
ArgusModeler.c:3313:104: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
 3313 |                                  ((unsigned int *)(dsr + 1))[2] = (((unsigned int *)&metric->dst.bytes)[0]);
      |                                                                                                        ^
cc1: some warnings being treated as errors
make[1]: *** [Makefile:74: ArgusModeler.o] Error 1
make[1]: Leaving directory '/var/tmp/portage/net-analyzer/argus-3.0.8.3-r2/work/argus-3.0.8.3/argus'

Full build log: build.log
Downstream report: https://bugs.gentoo.org/861146

@eli-schwartz eli-schwartz changed the title Build fails with LTO Build has strict-aliasing violations Feb 29, 2024
@openargus
Copy link
Owner

openargus commented Feb 29, 2024 via email

@eli-schwartz
Copy link
Author

Hi,

I am running Gentoo Linux and I tried compiling this package: https://packages.gentoo.org/packages/net-analyzer/argus

Gentoo only packages argus 3.0.8.3, although there's a notice that 3.0.8.4 is available and could be updated to. I don't see an argus 5 anywhere, and this GitHub repository doesn't have any git tags, let alone a version 5 tag.

So I am not sure how to try "argus-5.0".

I'm not working in a CI/CD pipeline. I compile all my software with -Werror=strict-aliasing because violations of the C standard's requirements for aliasing is UB and modern compilers will attempt to optimize by assuming UB cannot happen, and as a result will miscompile code that hss strict-aliasing issues and produce segfaults, general misbehavior, or possibly even the dreaded nasal demons. ;)

I wish it was a default compiler setting...

@openargus
Copy link
Owner

openargus commented Feb 29, 2024 via email

@eli-schwartz
Copy link
Author

I really wish people wouldn't do that...

The purpose of version control is to have, well, versions. Hiding different versions of the code elsewhere is just confusing.

Argus 5 isn't mentioned at https://openargus.org/getting-argus and isn't visible from the "argus" repo. It doesn't contain the same fixes, for example #5 doesn't appear to be present. It doesn't appear to have an official release. It is not clear that it is meant to be used, though perhaps if it was meant to be used it would be publicized.

On the flip side, this "argus 5" repository that isn't released does have openargus/argus-5.0@08a3e40 which seems... important. And it should probably be included in "argus" too.

(Why is it from 2018, but has never made it to a regular argus release?)

@openargus
Copy link
Owner

openargus commented Feb 29, 2024 via email

@eli-schwartz
Copy link
Author

Well apparently the mailing list doesn't even allow non-members to read-only view the contents, which is a bit exasperating since otherwise I would have already looked.

@openargus
Copy link
Owner

openargus commented Feb 29, 2024 via email

@openargus
Copy link
Owner

openargus commented Mar 1, 2024 via email

openargus added a commit that referenced this issue Mar 7, 2024
openargus added a commit that referenced this issue Mar 7, 2024
Merge pull request #8 from openargus/main
@openargus
Copy link
Owner

The branch v5.0.0 should satisfy all of Eli's issues regarding compiler warnings and errors ... If not, lets start another issue

@openargus openargus self-assigned this Mar 7, 2024
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

No branches or pull requests

2 participants