Re: Uninitialized variables and F37

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/11/22 19:35, Steve Grubb wrote:
On Monday, May 9, 2022 5:10:07 AM EDT Daniel P. Berrangé wrote:
   [snip]
Fast-forward a few months and I see GCC 12.1 is released now with
-ftrivial-auto-var-init option support [2].

Are you going to take this idea forward and make a formal change proposal
for Fedora to set -ftrivial-auto-var-init=zero by default in its default
RPM build flags ?

I've connected with the gcc folks and we will file a proposal in the near
future.

Zero is the worst possible auto-int value.  It will hide the most bugs.
Zero is unrecognizable as an auto-init value by hardware, code, and humans.

The auto-init value should be recognizable instantly in all circumstances.
The value which comes to mind is 0x81 in every byte.  This is the "core constant"
used by the Michigan Terminal System beginning 1967 (yes, 55 years ago!)
on IBM S/360-67 and S/370 hardware; see https://en.wikipedia.org/wiki/MTS_system_architecture.

As a signed integer the value is negative, which trips assumptions of "positive or zero"
for loop counters or array indices.  As a virtual address, (void *)0x818181..81
triggers a fault, thus catching uninit pointers.  0x81 stands out in a hex dump.
Programmers quickly learn the 32-bit integer value "-2122219135".

Please do not use zero as the default auto-init value.  Use 0x818181..81 instead.
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux