Re: GPC source code errors

Gale Paeper <[email protected]> Wed, 9 Mar 2016 16:14:58 -0800
Newsgroups gmane.comp.compilers.gpc
Message-ID <[email protected]>
> On Mar 9, 2016, at 6:33 AM, Waldek Hebisch <[email protected]> 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
[email protected]




_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc