Robert Hartmann | 18 Jun 2013 10:24
Picon

GPC for MinGW?

Hi list,

If it is possible to integrate GPC into an actual MinGW-based GCC4 port, 
I like to get some hint.

I would like to build in Msys (Windows XP),
but if it easyer to build under Linux, well then I hope I could do it with
Knoppix-Live-DVD. 

Best regards,
Robert

_______________________________________________
Gpc mailing list
Gpc <at> gnu.de
https://www.g-n-u.de/mailman/listinfo/gpc

Maurice Lombardi | 13 May 2013 18:38
Picon
Picon
Favicon

Fwd: Re: variable type cast


-------- Message original --------
Sujet: Re: variable type cast
Date : Mon, 13 May 2013 09:11:11 +0200
De : Maurice Lombardi <Maurice.Lombardi <at> ujf-grenoble.fr>
Pour : Jay Michael <jmichael_ll <at> yahoo.com>

Le 13/05/2013 01:12, Jay Michael a écrit :
> gpc version 20070904, based on gcc-3.4.5 (mingw special)
>       Given
>            type INT16  = INTEGER  attribute( size=16 ) ;
>            type WORD16 = Cardinal attribute( size=16 ) ;
>            var i16 : INT16 ;
>            var w16 : WORD16 ;
> why does
>            WORD16(I16) := W16 ;
> produce "error: invalid lvalue in assignment"?

First notice tht the other way around

    I16 := INT16(W16) ;

works.

Typecasts are C style unportable "extensions" which garble the
"write once, compile everywhere" philosophy behind the strong typing
principles of Pascal.
There is certainly nothing about it in the standards, and I do not know
at which point this "lvalue error" crept in first into C, and then into
Pascal.
(Continue reading)

Jay Michael | 13 May 2013 01:12
Picon
Favicon

variable type cast

gpc version 20070904, based on gcc-3.4.5 (mingw special)
 
     Given
          type INT16  = INTEGER  attribute( size=16 ) ;
          type WORD16 = Cardinal attribute( size=16 ) ;
          var i16 : INT16 ;
          var w16 : WORD16 ;
why does
          WORD16(I16) := W16 ;
produce "error: invalid lvalue in assignment"?

 
         
program jsm5( input, output ) ;
type
  INT16  = INTEGER  attribute( size=16 ) ;
  WORD16 = Cardinal attribute( size=16 ) ;
var
  i16 : INT16 ;
  w16 : WORD16 ;
begin
WORD16(I16) := W16 ; { error: invalid lvalue in assignment }
end.
_______________________________________________
Gpc mailing list
Gpc <at> gnu.de
https://www.g-n-u.de/mailman/listinfo/gpc
Jonas Maebe | 26 Apr 2013 21:01
Picon
Favicon

for-loops and subrange types

Hi,

Can anyone here offer some insights regarding the standard conformance of the test program submitted at
http://bugs.freepascal.org/view.php?id=24318 ? (range.p)

Both FPC and GPC cause the program to abort with a range check error, while the submitter is of the opinion
that the for-loop should merely short-circuit and never executed instead.

Jonas
_______________________________________________
Gpc mailing list
Gpc <at> gnu.de
https://www.g-n-u.de/mailman/listinfo/gpc

Thomas Schneider | 17 Feb 2013 08:17
Picon

GPC compiler crash

Folks:

I discovered a program that crashes the GPC compiler, attached.

Regards,

Tom

  Thomas D. Schneider, Ph.D.
  Senior Investigator
  National Institutes of Health
  National Cancer Institute
  Frederick National Laboratory for Cancer Research
  Gene Regulation and Chromosome Biology Laboratory
  Molecular Information Theory Group
  Frederick, Maryland  21702-1201
  schneidt <at> mail.nih.gov
  http://alum.mit.edu/www/toms
program trimdiana (da, output);
(* trimdiana: gpc crash

This Pascal program demonstrates an internal error crash of the Gnu
Pascal Compiler.  The crash occurs when one attempts to compile:

% gpc trimdiana.p
gpc: Internal error: Illegal instruction: 4 (program gpc1)
Please submit a full bug report.
See <URL:http://www.gnu-pascal.de/todo.html> for instructions.

This program is an extensively trimmed version of
http://alum.mit.edu/www/toms/delila/diana.html
setting 'trimax = 8006000' in that program is also sufficient
to cause the problem.

Tom

  Thomas D. Schneider, Ph.D.
  Senior Investigator
  National Institutes of Health
  National Cancer Institute
  Frederick National Laboratory for Cancer Research
  Gene Regulation and Chromosome Biology Laboratory
  Molecular Information Theory Group
  Frederick, Maryland  21702-1201
  schneidt <at> mail.nih.gov
  http://alum.mit.edu/www/toms

*)

const
   version = 2.17; 

(* THE KEY POINT: if trimax is 25000, gpc compiles ok.
If it is 8006000, gpc gives:

gpc: Internal error: Illegal instruction: 4 (program gpc1)
Please submit a full bug report.
See <URL:http://www.gnu-pascal.de/todo.html> for instructions.

*)
{ compile is ok with this value:
   trimax = 25000; (* the maximum number of data points *)
}
   trimax = 8006000; (* the maximum number of data points *)
   infofield = 6; (* real number field width *)
   infodecim = 5; (* number of decimal points *)

type

   (* define the four nucleotide bases *)
   base = (a,c,g,t);

   (* define a triangular array as a linear one *)
   trianglearray = record
      data: array[0..trimax] of integer;
      lower: integer; (* lower bound on the triangle *)
      upper: integer; (* upper bound on the triangle *)
      side: integer;  (* length of side of the triangle *)
      area: integer;  (* area of the triangle *)
   end;

   (* stores the number of dinucleotides appearing at positions on a sequence *)
   trisquare = array[a..t,a..t] of trianglearray;

var

   da: text; (* output file *)

procedure writeprism(var dianalysis: text; dataprism: trisquare);
begin
   writeln(dianalysis,'* sum of Rcorrelation ... bits');
end;

(* ********************************************************************* *)

procedure themain(var da: text);
var
  dataprism: trisquare;   (* the data structure for diana *)

begin
   writeln(output,' trimdiana -gpc bug',version:4:2);

{ It is necessary to call the procedure with the variable to cause
the gpc compile problem: }

   writeprism(da,dataprism);
end;

begin
   themain(da);
end.
_______________________________________________
Gpc mailing list
Gpc <at> gnu.de
https://www.g-n-u.de/mailman/listinfo/gpc

Re: Understanding {$I-} {$I+} ioResult

On 26 Nov 2012 at 14:59, Baudouin Le Charlier wrote:

> 
> Le 26 nov. 2012 à 12:39, Prof. A Olowofoyeku (The African Chief) a
> écrit :
> 
> > On 26 Nov 2012 at 9:10, Baudouin Le Charlier wrote:
> > 
> > [...]
> >>> This is a historical factor, and there was no need to duplicate
> >>> features that Borland already documented well, and which were well
> >>> known to Borland Pascal/Delphi programmers.
> >> 
> >> I am not sure they are so well known since you did not explain to
> >> me why (i.e. by which miracle) a program that stops abruptly (when
> >> compiled with $I-), stops normally if you add a call to ioResult
> >> *after* the io statement that makes the original program fail. I
> >> doubt very much that this could be explained in the original
> >> Borland documentation and also that this behavior should be well
> >> known of Borland Pascal programmers.
> > 
> > As I said, the Borland Pascal/Delphi help files are freely available
> > on the net. If you want to use Borland Pascal/Delphi compatibility
> > features in GPC, you would do well to study the Borland
> > documentation on those features.
> > 
> > This is from a 20 year old Borland Turbo Pascal help file:
> > 
> > [--- excerpt begins ---]
> > $I:  Input/Output-Checking Switch
> > Enables or disables the automatic code generation that checks the
> > result of a call to an I/O procedure 
> > 
> > Syntax:	$I+ or $I-
> > Default:	$I+
> > Type:	Local
> > Command-Line:	/$I+ or /$I-
> > Menu Command:	Options|Compiler|I/O Checking
> > 
> > Remarks
> > If an I/O procedure returns a non-zero I/O result when the $I switch
> > is on, the program terminates, displaying a run-time error message. 
> > 
> > 
> > When the $I switch is off, you must use the IOResult function to
> > check for I/O errors. [--- excerpt ends ---]
> > 
> > Please let us stop this meaningless debate now.
> 
> To me, it is not meaningless. I sent you an example where gnu pascal
> does not conform to the excerpt you just sent me : the program is
> compiled with the switch off but nevertheless it stops with an error
> message. 

And where in that code did you use the IOResult function to check for 
errors?

Best regards,  
 The Chief
-------
Prof. Abimbola Olowofoyeku (The African Chief)
Web: http://www.greatchief.plus.com

_______________________________________________
Gpc mailing list
Gpc <at> gnu.de
https://www.g-n-u.de/mailman/listinfo/gpc

Baudouin Le Charlier | 17 Nov 2012 16:13
Picon
Favicon

Bus error when writing in a typed file

 Hi !

 I am using a Mac OS X 10.6.8. I have downloaded GNU Pascal for Mac Os
fromhttp://www.microbizz.nl/gpc.html. I have been using GNU Pascal for writing very simple programs
for an introductory programming course and it worked fine until I wrote the following program for which I
got a "bus error" when writing a first record in the file (at line 128). Notice that the program executes
without errors when compiled with free pascal compiler. 

I should be happy if anyone can help me to solve this "problem".

Baudouin Le Charlier

Attachment (fileOfRecords.pas): application/octet-stream, 4617 bytes
_______________________________________________
Gpc mailing list
Gpc <at> gnu.de
https://www.g-n-u.de/mailman/listinfo/gpc
Thomas Schneider | 6 Sep 2012 01:27
Picon

Re: running gpc on Mac OS X 10.7.4

Kevan:

> I'm running GPC just fine on 10.7.4. I may have installed on an earlier 
> version of 10.7 and then upgraded. I installed the Mac OS X 10.6 Intel 
> version I found here:
> 
> http://www.microbizz.nl/gpc.html
> 
> What did you install?

I hadn't installed, but I went to that page and installed from
 • GNU Pascal 3.4.6u4 installer for Mac OS X 10.6 Intel native and PowerPC cross-compiler15.7 MB)

It SAYS it's supposed to be ONLY for 10.6, but I went ahead anyway on 10.7.

In /Developer/Pascal it installed cleanly and replaced directory
gpc346u2 with gpc346u4.

I can now compile:

egg 18% cat h.p
program helloworld (output);
begin
writeln(output,'hello world');
end.
egg 19% gpc h.p
ld: warning: -macosx_version_min not specified, assuming 10.7
ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed
PIE, but used in __start from /Developer/SDKs/MacOSX10.5.sdk//usr/lib/crt1.o. To fix this warning,
don't compile with -mdynamic-no-pic or link with -Wl,-no_pie
egg 20% a.out
hello world

Thanks,

Tom

  Thomas D. Schneider, Ph.D.
  Senior Investigator
  National Institutes of Health
  National Cancer Institute
  Frederick National Laboratory for Cancer Research
  Gene Regulation and Chromosome Biology Laboratory
  Molecular Information Theory Group
  Frederick, Maryland  21702-1201
  http://alum.mit.edu/www/toms

_______________________________________________
Gpc mailing list
Gpc <at> gnu.de
https://www.g-n-u.de/mailman/listinfo/gpc
Jay Michael | 3 Sep 2012 07:11
Picon
Favicon

MoveLeft / MoveRight special cases

     The procedures MoveLeft and MoveRight start with a test for whether special case code will be useful/possible.

procedure MoveLeft (const Source; var Dest; Count: SizeType);
  if (Count >= SizeOf (LongestCard))
  and not (pDst - pSrc in [0 .. 2 * SizeOf (TWord) - 1]) then

procedure MoveRight (const Source; var Dest; Count: SizeType);
  if (Count >= SizeOf (LongestCard))
  and not (pSrc - pDst in [0 .. 2 * SizeOf (TWord) - 1]) then

     Procedure Move calls MoveRight when the address of the source is less than the source of the destination, so
the difference will always be negative (except when source and destination are the same address), so the
difference will never be in the range [0..2*SizeOf(TWord)-1].

     Shouldn't those differences be reversed?

     Shouldn't the threshold be either SizeOf(LongestCard) in both clauses, or 2*SizeOf(TWord) in both clauses?

_______________________________________________
Gpc mailing list
Gpc <at> gnu.de
https://www.g-n-u.de/mailman/listinfo/gpc

Jay Michael | 3 Sep 2012 06:10
Picon
Favicon

RangeCheckError from RuntimeError

     My program was terminating with no runtime error message.  When run in gdb, gdb told me it terminated with
exit code 52 (I think octal).

     I had a Range Check Error.  In gdb, I see that _p_RangeCheckError calls _p_RuntimeError.  Then,
_p_RuntimeError has code that might call _p_RangeCheckError.  I didn't trace further -- gdb suddenly
becomes unable to single-step, says "Unable to set breakpoint number -37".  (The specific number changes
if I keep trying to single-step.  It's always negative.)

     I don't know how much better it would have been, but shouldn't _p_RuntimeError have been compiled with
range checking suppressed?

     (I've found source for RangeCheckError and RuntimeError.  I can't find source for CString2String -- is it
an intrinsic function?  It seems to have been inline coded in RuntimeError.)

_______________________________________________
Gpc mailing list
Gpc <at> gnu.de
https://www.g-n-u.de/mailman/listinfo/gpc

Jay Michael | 2 Sep 2012 07:22
Picon
Favicon

Re: Windows install

     Trying to get the source corresponding to the 20070904 Windows distribution, I have downloaded and unpacked

 gpc-20070904.tar.bz2
 mingw-gcc-core-3.4.5-20060117-2-src.tar.gz

     Between them, they don't seem to be the complete source of the binary distribution I have installed.

     I can't find any reference to "winmain", which I'm sure is involved in a Windows GUI application.

     The only version of "collect2" is in the "gcc" chain.  It doesn't invoke "windres", and it certainly doesn't
say "ld-orig" when it can't find "ld".

     What do I need to download to be in a position to build GPC under and for Windows?

_______________________________________________
Gpc mailing list
Gpc <at> gnu.de
https://www.g-n-u.de/mailman/listinfo/gpc


Gmane