Thread (2 messages) 2 messages, 2 authors, 2021-11-19

Re: New-ish warning in refs.c with GCC (at least 11.2) under -O3

flat view

From: Junio C Hamano <hidden>
Date: 2021-11-18 23:24:00

Possibly related (same subject, not in this thread)

Jeff King [off-list ref] writes:
quoted hunk
+	/*
+	 * Should be a noop per the ALLOWED_FLAGS check above, but this
+	 * is necessary to work around a problem with some versions of
+	 * "gcc -O3 -Wnonnull", which otherwise thinks that you can have the
+	 * flag set with a NULL new_oid.
+	 */
+	flags &= ~REF_HAVE_OLD | REF_HAVE_NEW;
Are you missing parentheses around ~(OLD|NEW)?
 	flags |= (new_oid ? REF_HAVE_NEW : 0) | (old_oid ? REF_HAVE_OLD : 0);
 
 	ref_transaction_add_update(transaction, refname, flags,

I do find it interesting that gcc really _is_ convinced that those flags
can be set coming in, since clearing them makes the problem go away.
...
Reading over the code, it all looks OK. And that size is...weirdly huge.
The original bug is really annoying and this looks even worse.
Hopefully it won't come down from experimental to more stable tracks
before they are corrected.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help