Project

General

Profile

Actions

Bug #14063

open

pnglite references UINT_MAX without including limits.h

Added by Thirteen Oxide 18 days ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
bootloader
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

This breaks the build with an error of the form:

.../usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/cw --linker .../usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/ld --primary gcc7,/opt/gcc/7/bin/gcc,gnu  --shadow smatch,.../usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/smatch,smatch -- -O -m32 -fpic -xspace -Xa  -xildoff -errtags=yes -errwarn=%all -erroff=E_EMPTY_TRANSLATION_UNIT -erroff=E_STATEMENT_NOT_REACHED -_gcc=-Wno-missing-braces -_gcc=-Wno-sign-compare -_gcc=-Wno-unknown-pragmas -_gcc=-Wno-unused-parameter -_gcc=-Wno-missing-field-initializers -_gcc=-Wno-array-bounds -_smatch=-p=illumos_user -_smatch=--disable=uninitialized,check_check_deref -_smatch=-Wno-vla -_smatch=-Wno-one-bit-signed-bitfield -_smatch=-Wno-external-function-has-definition -_smatch=-Wno-old-style-definition -_smatch=-Wno-strict-prototypes -_smatch=--fatal-checks -_smatch=--timeout=0   -xc99=%all    -W0,-xglobalstatic -_gcc=-fno-inline-small-functions  -_gcc=-fno-inline-functions-called-once  -_gcc=-fno-ipa-cp  -_gcc7=-fno-ipa-icf  -_gcc8=-fno-ipa-icf  -_gcc9=-fno-ipa-icf  -_gcc10=-fno-ipa-icf  -_gcc7=-fno-clone-functions  -_gcc8=-fno-clone-functions  -_gcc9=-fno-clone-functions  -_gcc10=-fno-clone-functions -_gcc7=-fno-reorder-functions  -_gcc8=-fno-reorder-functions  -_gcc9=-fno-reorder-functions  -_gcc10=-fno-reorder-functions  -_gcc7=-fno-aggressive-loop-optimizations  -_gcc8=-fno-aggressive-loop-optimizations  -_gcc9=-fno-aggressive-loop-optimizations  -_gcc10=-fno-aggressive-loop-optimizations    -_gcc4=-fstack-protector -_gcc7=-fstack-protector-strong -_gcc8=-fstack-protector-strong -_gcc9=-fstack-protector-strong -_gcc10=-fstack-protector-strong -fPIC -g -_cc=-xdebugformat=stabs -_gcc=-gdwarf-2 -_gcc10=-gstrict-dwarf -xc99=%all -W0,-noglobal  -DTEXT_DOMAIN=\"SUNW_OST_OSLIB\" -D_TS_ERRNO  -I.../proto/root_i386/usr/include     -I.../smartos-live/proto.strap/usr/include -I.. -I.../usr/src/common/ficl -I/home/wesolows/src/illumos-gate/usr/src/common/ficl/emu -D_LARGEFILE64_SOURCE=1 -I.../usr/src/common/pnglite -I.../usr/src/common/lz4 -DPIC -D_REENTRANT -c -o pics/pnglite.o .../usr/src/common/pnglite/pnglite.c
+ /opt/gcc/7/bin/gcc -fident -finline -fno-inline-functions -fno-builtin -fno-asm -fdiagnostics-show-option -nodefaultlibs -D__sun -O -m32 -fpic -Wall -Wextra -Werror -Wno-missing-braces -Wno-sign-compare -Wno-unknown-pragmas -Wno-unused-parameter -Wno-missing-field-initializers -Wno-array-bounds -std=gnu99 -fno-inline-small-functions -fno-inline-functions-called-once -fno-ipa-cp -fno-ipa-icf -fno-clone-functions -fno-reorder-functions -fno-aggressive-loop-optimizations -fstack-protector-strong -fPIC -g -gdwarf-2 -std=gnu99 -DTEXT_DOMAIN="SUNW_OST_OSLIB" -D_TS_ERRNO -I.../proto/root_i386/usr/include -I.../smartos-live/proto.strap/usr/include -I.. -I.../usr/src/common/ficl -I.../usr/src/common/ficl/emu -D_LARGEFILE64_SOURCE=1 -I.../usr/src/common/pnglite -I.../usr/src/common/lz4 -DPIC -D_REENTRANT -c -o pics/pnglite.o .../usr/src/common/pnglite/pnglite.c
.../usr/src/common/pnglite/pnglite.c: In function 'png_open':
.../usr/src/common/pnglite/pnglite.c:214:14: error: 'UINT_MAX' undeclared (first use in this function); did you mean 'WINT_MAX'?
   if (size < UINT_MAX)
              ^~~~~~~~
              WINT_MAX
.../usr/src/common/pnglite/pnglite.c:214:14: note: each undeclared identifier is reported only once for each function it appears in

I do not understand why everyone doesn't see this build failure, probably it is something very specific to compiler versions and I assume mine is "wrong". However, the bug is very definitely real, and I know I'm not alone because Joyent fixed it in their gate as a build failure introduced by 10063; that fix was in 66b9606131b15c87650523d677d70277878480f6 (see https://github.com/joyent/illumos-joyent/blame/master/usr/src/common/pnglite/pnglite.c). That fix is correct; the diff is:

diff --git a/usr/src/common/pnglite/pnglite.c b/usr/src/common/pnglite/pnglite.c
index 59b9df1db6..7ea32c002d 100644
--- a/usr/src/common/pnglite/pnglite.c
+++ b/usr/src/common/pnglite/pnglite.c
@@ -9,6 +9,7 @@
 #else
 #include <stdio.h>
 #include <stdlib.h>
+#include <limits.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>

No data to display

Actions

Also available in: Atom PDF