On Mar 9, 2016, at 6:33 AM, Waldek Hebisch hebisch@math.uni.wroc.pl wrote:
Gale Paeper wrote:
While trying to get a successful compilation of GPC on Mac OS X 10.11 using Appleâs LLVM based tool chain, I discovered what looks to be a couple of source code errors in p/statements.c in the expand_pascal_assignment2 functionâs code. That function is declared with a void return type so there shouldnât be any return statements returning a value anywhere within the body of the function but there are two uses of the CHK_EM macro which does expand to a return statement that potentially returns a value (a tree type). Trying to potentially return something into the void of a non-existant return isnât technically correct code and I havenât found a way to get the LLVM based clang compiler to accept it.
Iâll note that you can get a gnu gcc version 5.2.0 compiler to accept the code when compiling with the -std=gnu89 command line option.
The GPC source code version Iâm trying to get compiling is the Adriaan van Osâs Mac OS X patched gcc 3.4.6 with the p directory replaced with Waldek Hebischâs git repositoryâs (https://github.com/hebisch/gpc) p directory source code. The code fragment containing the error producing code starting around line 1231 in file p/statements.c (in expand_pascal_assignment2 functionâs body) is:
schema_source = undo_schema_dereference (source); schema_target = undo_schema_dereference (target); DEREFERENCE_SCHEMA (source); DEREFERENCE_SCHEMA (target); CHK_EM (source); CHK_EM (target);
The patch below should fix this:
diff --git a/p/statements.c b/p/statements.c index 4904834..e0026b7 100644 --- a/p/statements.c +++ b/p/statements.c @@ -1232,8 +1232,8 @@ expand_pascal_assignment2 (tree target, tree source, int is_init) schema_target = undo_schema_dereference (target); DEREFERENCE_SCHEMA (source); DEREFERENCE_SCHEMA (target);
- CHK_EM (source);
- CHK_EM (target);
if (EM (source)||EM (target))
return;
/* Restricted types. @@@@ Maybe this needs further checking */ if (TREE_CODE (source) == CALL_EXPR && PASCAL_TYPE_RESTRICTED (TREE_TYPE (source)))
For current version (i.e., 10.11) Mac OS X interested builders of gpc, that patch along with configuring to use a gnu based as assembler (to work around stabs based debugging issues) looks to allow compiling a gcc-3.4.6 based gpc with Apple's Xcode 7.x LLVM based clang compiler.
Still no success in getting a working gpc built. Quite a few bootstrapping problems remain; however, I think they are mostly related to linking issues arising from changes in Apple's linker and the continuing OS version dependent revamping of linking requirements. The major headache looks to be wrestling the decade old configure, build, and linker specs (and libraries) into working with Apple's latest linker's expectations.
Gale Paeper gpaeper@empirenet.com