Most COBOL programmers (that I know) are old mainframe programmers.
They know COBOL but that fact that GnuCOBOL secretly generates C and then uses the C compiler is a mystery to many of them.
Also, for my customers, I provide a pre-built binary install tar file. They just extract the contents and the execute the 'install' script that I provide.
They can grab the code if they want, but most do not want to look at that.
So having the GnuCOBOL compiler have default values to CFLAGS pre-built into the compiler is an important feature because in these cases, the programmer using the GnuCOBOL compiler knows nothing about C.
On Thu, Apr 11, 2019 at 6:14 PM James K. Lowden <jklowden@xxxxxxxxxxxxxxx> wrote:
On Thu, 11 Apr 2019 19:27:52 +0200
Simon Sobisch <simonsobisch@xxxxxx> wrote:
> Actually I'm normally hacking defaults.h after its generation to
> remove anything I feel is unneeded, then run make checkall and if
> everything pass am confident enough that I did not mis-hack the
> defaults (or go back adding in what is necessary and do it again)...
Hmm. I changed my "gen" script to remove strict-alasing (option and
warning, both) from COB_FLAGS in defaults.h before building the
compiler. It still fails, and it's still using those options.
COBC is
'/home/jklowden/projects/3rd/cobol/branches/pangaea/build.db/cobc/cobc'
+ _return_path ../../extras/CBL_OC_DUMP.cob
+ echo ../../extras/CBL_OC_DUMP.cob
+ /home/jklowden/projects/3rd/cobol/branches/pangaea/build.db/cobc/cobc
-v -m -Wall -O2 -o CBL_OC_DUMP.so ../../extras/CBL_OC_DUMP.cob loading
standard configuration file 'default.conf' command
line: /home/jklowden/projects/3rd/cobol/branches/pangaea/build.db/cobc/.libs/lt-cobc
-v -m -Wall -O2 -o CBL_OC_DUMP.so ../../extras/CBL_OC_DUMP.cob
preprocessing: ../../extras/CBL_OC_DUMP.cob -> /tmp/cob21006_0.cob
return status: 0 parsing: /tmp/cob21006_0.cob
(../../extras/CBL_OC_DUMP.cob) return status: 0
translating: /tmp/cob21006_0.cob -> /tmp/cob21006_0.c
(../../extras/CBL_OC_DUMP.cob)
executing: gcc
-I/home/jklowden/projects/3rd/cobol/branches/pangaea/build.db/..
-I/home/jklowden/projects/3rd/cobol/branches/pangaea/build.db/../libcob
-I/home/jklowden/pangaea/db/include -Wno-unused
-fsigned-char -I/usr/local/include/libxml2 -I/usr/local/include
-fstrict-aliasing --std=c11 -Wswitch -Werror -Wall
-Wpointer-arith -Wstrict-aliasing -Wno-unused-function
-Wno-unused-value -Wno-missing-braces -Wno-parentheses
-Wno-unused-result -Wno-format-security -pipe -O2
-shared -fPIC -DPIC -Wl,--export-dynamic -o "CBL_OC_DUMP.so"
"/tmp/cob21006_0.c"
-L/home/jklowden/projects/3rd/cobol/branches/pangaea/build.db/libcob/.libs
-L/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib
-L/home/jklowden/projects/3rd/cobol/branches/pangaea/build.db/libcob/.libs
-lcob -lm -L/usr/local/lib -lxml2 -lgmp -lncurses
-ldb-5.3 -ldl
/tmp/cob21006_0.c: In function 'CBL_OC_DUMP_':
/tmp/cob21006_0.c:251:5: error: dereferencing type-punned pointer will
break strict-aliasing rules [-Werror=strict-aliasing]
if (((int)cob_cmp_llint (&f_46, (*(unsigned int *)(b_11))) < 0))
^
The option appears only in COB_BUILD_CFLAGS:
$ grep aliasing build.db/defaults.h
#define COB_BLD_CFLAGS "-g -O0 -fstrict-aliasing --std=c11 -Wswitch
-Werror -Wall -Wpointer-arith -Wstrict-aliasing -Wno-unused-function
-Wno-unused-value -Wno-missing-braces -Wno-parentheses
-Wno-unused-result -Wno-format-security -pipe -fsigned-char -Wall
-Wwrite-strings -Wmissing-prototypes -Wno-format-y2k"
--jkl
Cheers
Ron Norman