HomeFreeBSD

lua: avoid gcc -Wreturn-local-addr bug

Description

lua: avoid gcc -Wreturn-local-addr bug

Avoid a bug with gcc's -Wreturn-local-addr warning with some
obfuscation. In buggy versions of gcc, if a return value is an
expression that involves the address of a local variable, and even if
that address is legally converted to a non-pointer type, a warning may
be emitted and the value of the address may be replaced with zero.
Howerver, buggy versions don't emit the warning or replace the value
when simply returning a local variable of non-pointer type.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90737

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Libby <rlibby@FreeBSD.org>
Closes #11337

Details

Provenance
rlibbyAuthored on Dec 15 2020, 5:20 PM
GitHub <noreply@github.com>Committed on Dec 15 2020, 5:20 PM
Parents
rG956f94010f31: spa: avoid type narrowing warning
Branches
Unknown
Tags
Unknown