https://bugzilla.redhat.com/show_bug.cgi?id=1242980
Bug ID: 1242980 Summary: Compiler warnings in hv_func.h Product: Fedora Version: rawhide Component: perl Assignee: jplesnik@redhat.com Reporter: jsafrane@redhat.com QA Contact: extras-qa@fedoraproject.org CC: cweyl@alumni.drew.edu, iarnell@gmail.com, jplesnik@redhat.com, kasal@ucw.cz, perl-devel@lists.fedoraproject.org, ppisar@redhat.com, psabata@redhat.com, rc040203@freenet.de, tcallawa@redhat.com
I get following warnings when compiling net-snmp with -Wall:
gcc -c -I../../include -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -g -O2 -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib64/perl5/CORE -Wall -Wstrict-prototypes -Wwrite-strings -Wcast-qual -I. -I/usr/local/include -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DVERSION="5.08" -DXS_VERSION="5.08" -fPIC "-I/usr/lib64/perl5/CORE" default_store.c In file included from /usr/lib64/perl5/CORE/hv.h:629:0, from /usr/lib64/perl5/CORE/perl.h:3344, from default_store.xs:6: /usr/lib64/perl5/CORE/hv_func.h: In function ‘S_perl_hash_siphash_2_4’: /usr/lib64/perl5/CORE/hv_func.h:201:23: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] U64TYPE k0 = ((U64TYPE*)seed)[0]; ^ /usr/lib64/perl5/CORE/hv_func.h:202:23: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] U64TYPE k1 = ((U64TYPE*)seed)[1]; ^ In file included from /usr/lib64/perl5/CORE/hv.h:629:0, from /usr/lib64/perl5/CORE/perl.h:3344, from default_store.xs:6: /usr/lib64/perl5/CORE/hv_func.h: In function ‘S_perl_hash_superfast’: /usr/lib64/perl5/CORE/hv_func.h:260:18: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] U32 hash = *((U32*)seed) + len; ^ In file included from /usr/lib64/perl5/CORE/hv.h:629:0, from /usr/lib64/perl5/CORE/perl.h:3344, from default_store.xs:6: /usr/lib64/perl5/CORE/hv_func.h: In function ‘S_perl_hash_murmur3’: /usr/lib64/perl5/CORE/hv_func.h:364:16: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] U32 h1 = *((U32*)seed); ^ In file included from /usr/lib64/perl5/CORE/hv.h:629:0, from /usr/lib64/perl5/CORE/perl.h:3344, from default_store.xs:6: /usr/lib64/perl5/CORE/hv_func.h:401:21: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] k1 = U8TO32_LE(ptr); ^ /usr/lib64/perl5/CORE/hv_func.h:408:24: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] carry = U8TO32_LE(ptr); ^ /usr/lib64/perl5/CORE/hv_func.h:416:24: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] carry = U8TO32_LE(ptr); ^ /usr/lib64/perl5/CORE/hv_func.h:424:24: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] carry = U8TO32_LE(ptr); ^ /usr/lib64/perl5/CORE/hv_func.h: In function ‘S_perl_hash_djb2’: /usr/lib64/perl5/CORE/hv_func.h:458:18: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] U32 hash = *((U32*)seed + len); ^ /usr/lib64/perl5/CORE/hv_func.h: In function ‘S_perl_hash_sdbm’: /usr/lib64/perl5/CORE/hv_func.h:468:18: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] U32 hash = *((U32*)seed + len); ^ In file included from /usr/lib64/perl5/CORE/hv.h:629:0, from /usr/lib64/perl5/CORE/perl.h:3344, from default_store.xs:6: /usr/lib64/perl5/CORE/hv_func.h: In function ‘S_perl_hash_one_at_a_time’: /usr/lib64/perl5/CORE/hv_func.h:494:18: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] U32 hash = *((U32*)seed) + len; ^ /usr/lib64/perl5/CORE/hv_func.h: In function ‘S_perl_hash_one_at_a_time_hard’: /usr/lib64/perl5/CORE/hv_func.h:509:18: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] U32 hash = *((U32*)seed) + len; ^ /usr/lib64/perl5/CORE/hv_func.h: In function ‘S_perl_hash_old_one_at_a_time’: /usr/lib64/perl5/CORE/hv_func.h:544:18: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] U32 hash = *((U32*)seed); ^
This pollutes build logs and we may miss some useful warning. What about this?
- U32 hash = *((U32*)seed) + len; + U32 hash = (U32) *seed + len;
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
--- Comment #2 from Fedora End Of Life jkurik@fedoraproject.org --- This message is a reminder that Fedora 23 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 23. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '23'.
Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 23 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
Petr Pisar ppisar@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|23 |24
--- Comment #3 from Petr Pisar ppisar@redhat.com --- The proposed change is wrong. Original code copies 4 bytes from a memory specified by a pointer. Proposed code would take 1 byte from a memory specified by a pointer and coerced the value to a 4-byte integer.
But your point about the cast constness is valid.
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
Petr Pisar ppisar@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Compiler warnings in |-Wcast-qual compiler |hv_func.h |warnings in hv_func.h
--- Comment #4 from Petr Pisar ppisar@redhat.com --- Reproducer:
$ printf '#include "EXTERN.h"\n#include "perl.h"\n' | gcc -Wcast-qual -I/usr/lib64/perl5/CORE -c -x c - In file included from /usr/lib64/perl5/CORE/hv.h:629:0, from /usr/lib64/perl5/CORE/perl.h:3740, from <stdin>:2: /usr/lib64/perl5/CORE/hv_func.h: In function ‘S_perl_hash_siphash_2_4’: /usr/lib64/perl5/CORE/hv_func.h:213:17: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] U64TYPE k0 = ((U64TYPE*)seed)[0]; ^ et cetera.
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
Petr Pisar ppisar@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED URL| |https://rt.perl.org/Ticket/ | |Display.html?id=130169 Assignee|jplesnik@redhat.com |ppisar@redhat.com
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
Petr Pisar ppisar@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |POST
--- Comment #5 from Petr Pisar ppisar@redhat.com --- I developed fixes that are under review now. However upstream developmental code added new violating in-line functions that he does not to fix. So probably you will have to live with some warnings in the future.
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
Petr Pisar ppisar@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |Patch Status|POST |ASSIGNED
--- Comment #6 from Petr Pisar ppisar@redhat.com --- Upstream accepted the fixes. The new violations were fixed by suppressing the warnings.
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
Petr Pisar ppisar@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |MODIFIED Fixed In Version| |perl-5.24.0-381.fc26
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
--- Comment #7 from Fedora Update System updates@fedoraproject.org --- perl-5.24.0-380.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-213ba43154
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
--- Comment #8 from Fedora Update System updates@fedoraproject.org --- perl-5.22.2-365.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-85dffa754f
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
Fedora Update System updates@fedoraproject.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|MODIFIED |ON_QA
--- Comment #9 from Fedora Update System updates@fedoraproject.org --- perl-5.24.0-380.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-213ba43154
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
--- Comment #10 from Fedora Update System updates@fedoraproject.org --- perl-5.22.2-365.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-85dffa754f
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
Fedora Update System updates@fedoraproject.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|ON_QA |CLOSED Fixed In Version|perl-5.24.0-381.fc26 |perl-5.24.0-381.fc26 | |perl-5.24.0-380.fc25 Resolution|--- |ERRATA Last Closed| |2016-12-22 00:24:26
--- Comment #11 from Fedora Update System updates@fedoraproject.org --- perl-5.24.0-380.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.
https://bugzilla.redhat.com/show_bug.cgi?id=1242980
Fedora Update System updates@fedoraproject.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed In Version|perl-5.24.0-381.fc26 |perl-5.24.0-381.fc26 |perl-5.24.0-380.fc25 |perl-5.24.0-380.fc25 | |perl-5.22.2-365.fc24
--- Comment #12 from Fedora Update System updates@fedoraproject.org --- perl-5.22.2-365.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
perl-devel@lists.fedoraproject.org