From: <Joe...@t-...> - 2016-05-09 17:46:51
|
Hi, Daniel Jour wrote (in March): >* Undefined behavior, probably mostly in spvw* and also sort.d: >Stuff like comparing (less, greater) pointers, out of bounds indexing and >some cast just aren't legal C, and can lead to all sorts of nasty bugs, >especially when using an optimizing compiler. I'd guess that's the reason >that (e.g.) my distributions build instructions pass in CFLAGS=-O0. -O0?!? That feels like a slap in the face. Decades ago, we spent countless hours looking at assembly output and optimizing this and that, measuring time. We felt that even small performance improvements (i.e. ~2%) were worth it. That's the origin of the dotimespL() macros. We were very proud when something produced a 5% improvement. Bruno regularly scrutinized the bytecode interpreter loop, which is the #1 hot spot. IIRC, parts of the old libffcall would not even work with -O0, because it relied on some stack optimizations by GCC, like -fomit-frame-pointer. (Nowadays, I don't know whether libffcall still makes use of the asm files, or compiles even the lowest-level stuff from C). -O0 output is so pitiful to look at. Regarding the recent changes in C compilers, I believe it would be preferable to use, like several other projects, e.g. the Linux kernel or PostgreSQL, options like -fno-strict-overflow (or -fwrapv), -fno-delete-null-pointer-checks, -fno-strict-aliasing and whatever else in order to use optimizations yet behave like all C compilers used to behave during the last decades. Later, one can add additional casts, wrapped in yet more macros...;-) to compare pointers of different kinds. Sam Steingold wrote: > I see no problem in relying on external libraries. Nowadays. Initially, Bruno reported that lots of libraries on the many UNIX systems that CLISP ran on had lots of different bugs, and he was not amused. As a result, when I did the Amiga port, he advised that we avoid any lib, thus Amiga-CLISP used nothing but (the equivalent of) syscalls, no wrappers, and I even wrote the C startup code. On UNIX, CLISP started using configure. Regards, Jörg Höhle |