Skip to content

Commit

Permalink
Compile with -fno-strict-overflow
Browse files Browse the repository at this point in the history
This causes signed integer & pointer overflow to have a defined
behaviour of wrapping according to two's compliment. I.e INT_MAX will
wrap to INT_MIN and vice versa.

This is mainly to cover existing cases, not an invitation to add more.

Cc: Dan Callahan <d.callahan@f5.com>
Suggested-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
  • Loading branch information
ac000 committed Mar 9, 2024
1 parent 0b5223e commit c1e3f02
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions auto/cc/test
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ case $NXT_CC_NAME in
# Do not export symbols except explicitly marked with NXT_EXPORT.
NXT_CFLAGS="$NXT_CFLAGS -fvisibility=hidden"

NXT_CFLAGS="$NXT_CFLAGS -fno-strict-overflow"

# c99/gnu99 conflict with Solaris XOPEN.
#NXT_CFLAGS="$NXT_CFLAGS -std=gnu99"

Expand Down Expand Up @@ -107,6 +109,8 @@ case $NXT_CC_NAME in
# Do not export symbols except explicitly marked with NXT_EXPORT.
NXT_CFLAGS="$NXT_CFLAGS -fvisibility=hidden"

NXT_CFLAGS="$NXT_CFLAGS -fno-strict-overflow"

NXT_CFLAGS="$NXT_CFLAGS -O"
#NXT_CFLAGS="$NXT_CFLAGS -O0"
NXT_CFLAGS="$NXT_CFLAGS -Wall -Wextra"
Expand Down

0 comments on commit c1e3f02

Please sign in to comment.