#76 2.1: LINE/COL 0 causes internal compiler error

unclassified
closed
Ron Norman
None
6
2014-07-28
2014-06-10
Edward Hart
No

When LINE 0, LINE PLUS 0 or COL 0 is specified on a report data item, the compiler fails with an internal error. Take the following program:

       >>SOURCE FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. pos-test.

ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
    SELECT out-file ASSIGN "blah.txt"
        ORGANIZATION LINE SEQUENTIAL.

DATA DIVISION.
FILE SECTION.
FD  out-file REPORT rp.

REPORT SECTION.
RD  rp.
01  rp-detail TYPE DE.
    03  LINE 1, COL 0 VALUE "Hello!".

PROCEDURE DIVISION.
    OPEN OUTPUT out-file
    INITIATE rp
    GENERATE rp-detail
    TERMINATE rp
    CLOSE out-file
    .
END PROGRAM pos-test.

Then the internal error message is:

./something.cob: 18: Error: Invalid integer
Invalid literal cast - Aborting
tree.c:869 Internal compiler error
Aborting compile of ./something.cob at line 18

COL PLUS 0 should also fail with the same error, but does not do so because the relevant line of parser.y (line 4922) reads:

  PLUS integer

instead of the "correct":

  PLUS report_integer

Related

Bugs: #76

Discussion

  • Simon Sobisch
    Simon Sobisch
    2014-06-11

    Accepted and assigned to Ron Norman.

    BTW: The integer checks (parser.y/typeck.c) are likely to change in 2.x (still a work-in-progress).

     
  • Simon Sobisch
    Simon Sobisch
    2014-06-11

    • status: open --> accepted
    • assigned_to: Ron Norman
    • Priority: 1 --> 6
     
    • Ron Norman
      Ron Norman
      2014-06-11

      Problems fixed with code changes just posted.

      svn commit -m "Fix problem with missing COLUMN directive"
      Password:
      Sending reportwriter/cobc/codegen.c
      Sending reportwriter/cobc/field.c
      Sending reportwriter/cobc/tree.c
      Sending reportwriter/tests/testsuite.src/run_reportwriter.at
      Transmitting file data ....
      Committed revision 278.

      On Wed, Jun 11, 2014 at 2:43 AM, Simon Sobisch sf-mensch@users.sf.net
      wrote:

      • status: open --> accepted
      • assigned_to: Ron Norman
      • Priority: 1 --> 6
      • Comment:

      Accepted and assigned to Ron Norman.

      BTW: The integer checks (parser.y/typeck.c) are likely to change in 2.x
      (still a work-in-progress).


      Status: accepted
      Group: open
      Created: Tue Jun 10, 2014 09:22 AM UTC by Edward Hart
      Last Updated: Tue Jun 10, 2014 09:22 AM UTC
      Owner: Ron Norman

      When LINE 0, LINE PLUS 0 or COL 0 is specified on a report data item, the
      compiler fails with an internal error. Take the following program:

         >>SOURCE FREEIDENTIFICATION DIVISION.PROGRAM-ID. pos-test.
      

      ENVIRONMENT DIVISION.INPUT-OUTPUT SECTION.FILE-CONTROL.
      SELECT out-file ASSIGN "blah.txt"
      ORGANIZATION LINE SEQUENTIAL.
      DATA DIVISION.FILE SECTION.FD out-file REPORT rp.
      REPORT SECTION.RD rp.01 rp-detail TYPE DE.
      03 LINE 1, COL 0 VALUE "Hello!".
      PROCEDURE DIVISION.
      OPEN OUTPUT out-file
      INITIATE rp
      GENERATE rp-detail
      TERMINATE rp
      CLOSE out-file
      .END PROGRAM pos-test.

      Then the internal error message is:

      ./something.cob: 18: Error: Invalid integerInvalid literal cast - Abortingtree.c:869 Internal compiler errorAborting compile of ./something.cob at line 18

      COL PLUS 0 should also fail with the same error, but does not do so
      because the relevant line of parser.y (line 4922) reads:

      PLUS integer

      instead of the "correct":

      PLUS report_integer


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/open-cobol/bugs/76/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      Cheers
      Ron Norman

       

      Related

      Bugs: #76

  • Simon Sobisch
    Simon Sobisch
    2014-06-13

    Part fixed: According to 13.18.34 LINE clause zero is fine:

    "LINE PLUS integer-2" - "Integer-2 may be zero."

    I've changed the test suite accordingly (#94 fails) and uploaded it. @Please do an svn update and try to fix it.

    Simon

     
    • Ron Norman
      Ron Norman
      2014-06-14

      Done:

      svn commit -m "Fix PLUS report_integer"
      Password:
      Sending reportwriter/cobc/ChangeLog
      Sending reportwriter/cobc/parser.y
      Transmitting file data ..
      Committed revision 281.

      --
      Cheers
      Ron Norman

       
      Last edit: Simon Sobisch 2014-06-19
  • Simon Sobisch
    Simon Sobisch
    2014-06-14

    @Ron: Thank you for investigating this. But I'm confused. You've wrote that you fixed the parser (to accept LINE PLUS 0/zero) but inserted error messages back into the testsuite that show they're not accepted???
    Did I miss something or understood the quoted part of the COBOL 2002 standard wrong?

    Simon

     
    • Ron Norman
      Ron Norman
      2014-06-14

      Maybe I screwed up. But I thought it was supposed to give an error if 0 is used or anything but a simple integer.

      --
      Cheers
      Ron Norman

       
      Last edit: Simon Sobisch 2014-06-19
      Attachments
    • Ron Norman
      Ron Norman
      2014-06-15

      I guess I will have to find a PDF of the COBOL 2002 standard. I actually
      thought that REPORT DIVISION had been obsoleted and I have been following
      the documentation for the UNISYS COBOL compiler.

      Using 0 for LINE or COL does not make much sense so I thought it was not to
      be allowed.

      --
      Cheers
      Ron Norman

       
      Last edit: Simon Sobisch 2014-06-19
      Attachments
  • Simon Sobisch
    Simon Sobisch
    2014-06-19

    Fixed in svn by Ron --> closing this bug as solved.

     
  • Simon Sobisch
    Simon Sobisch
    2014-06-19

    • status: accepted --> closed