Bug#1135526: Possible miscompilation at -O2
David Bremner <[email protected]> Sun, 03 May 2026 09:19:37 +0900
| Newsgroups | gmane.linux.debian.devel.gcc |
|---|---|
| Message-ID | <87lde12vl2.fsf__22096.5646601812$1777767684$gmane$org@tethera.net> |
David Bremner <[email protected]> writes: > > Element 0 of reply_to_map gets field get_header initialized properly > with O1 but set to 0x0 at level O2. The latter is of course fatal > when the code just below tries to call through this table. > The other elements of the table look OK. > > struct { > InternetAddressList * (*get_header)(GMimeMessage *message); > GMimeAddressType recipient_type; > } reply_to_map[] = { > { get_sender, GMIME_ADDRESS_TYPE_TO }, > { get_to, GMIME_ADDRESS_TYPE_TO }, > { get_cc, GMIME_ADDRESS_TYPE_CC }, > { get_bcc, GMIME_ADDRESS_TYPE_BCC }, > }; > I learned that declaring this array as static const seems to fix the initialization, although I'm not really sure how to interpret that.