Loading ...
Sorry, an error occurred while loading the content.
 

Re: -boost crashes, -no_check doesn't

Expand Messages
  • Kolari S. Bhat
    ... The generated C code, compiles with LCC too. (My LCC version had a date of Aug, 2000). The test executable has no visible output, due to the loop s exit
    Message 1 of 25 , Feb 1, 2001
      Marcio Marchini wrote:

      > > > Your errors seem very similar to the
      > > ones I had with
      > > > expanded types. Have you looked at my message ? It is at
      > > > http://groups.yahoo.com/group/smalleiffel/message/2850
      > > >
      > > > See if it helps you, let me know.
      > > >
      > > > Although I think I was getting errors
      > > in all modes with
      > > > those expanded types, so I am not sure...
      > > >
      > > > marcio
      > >
      > > If I didn't miss anything, your test code
      > > (included in your original
      > > message) seems to compile and run fine.
      >
      > Hmmmm.... I use lcc, maybe that's it ?!
      >
      > It would be nice if somebody else with lcc could confirm.
      >

      The generated C code, compiles with LCC too. (My LCC version had a
      date of Aug, 2000). The test executable has no visible output, due to
      the loop's exit condition (in main.e). I am not sure if we both are
      using the same test code; I down loaded the attachment from Loria's
      SE-mail archive. Hope this helps.

      Kolari

      >
      > > I am using SE -0.75Beta#4 and GCC 2.95.2. The
      > > compile_to_c and GCC were
      > > run separately. Hope this helps in resolving
      > > the problem.
      >
      > Maybe it works under gcc, but not lcc. I wonder about bcc
      > ... :-)
      >
      > marcio
    • Marcio Marchini
      ... That s bizarre. I just tried it again on my PC, still no good. I compile like this: compile -clean -no_style_warning main make and I still get this: Error
      Message 2 of 25 , Feb 1, 2001
        > The generated C code, compiles with LCC too. (My
        > LCC version had a
        > date of Aug, 2000). The test executable has no
        > visible output, due to
        > the loop's exit condition (in main.e). I am not
        > sure if we both are
        > using the same test code; I down loaded the
        > attachment from Loria's
        > SE-mail archive. Hope this helps.


        That's bizarre. I just tried it again on my PC, still no
        good.

        I compile like this: compile -clean -no_style_warning main
        make

        and I still get this:

        Error main1.c: 2838 illegal expression
        Error main1.c: 2838 syntax error; found `0' expecting `)'
        Error main1.c: 2838 operands of = have illegal types
        `struct S19' and `int'
        Error main1.c: 2838 Syntax error; missing semicolon before
        `0'
        Warning main1.c: 2838 Statement has no effect
        Error main1.c: 2838 Syntax error; missing semicolon before
        `}'
        Error main1.c: 2838 illegal statement termination
        Error main1.c: 2838 skipping `)'
        Error main1.c: 2840 unrecognized declaration
        Warning main1.c: 2840 no type specified. Defaulting to int
        Error main1.c: 2840 syntax error; found `!' expecting `)'
        Error main1.c: 2840 missing identifier
        Error main1.c: 2840 Syntax error; missing semicolon before
        `!'
        Error main1.c: 2840 unrecognized declaration
        Warning main1.c: 2840 no type specified. Defaulting to int
        Error main1.c: 2840 syntax error; found `.' expecting `)'
        Error main1.c: 2840 syntax error; found `.' expecting `)'
        Error main1.c: 2840 syntax error; found `.' expecting `)'
        Error main1.c: 2840 Syntax error; missing semicolon before
        `.'
        Error main1.c: 2840 skipping `.'
        Warning main1.c: 2840 no type specified. Defaulting to int
        Error main1.c: 2840 redeclaration of `p' previously
        declared at c:\....\main.h 600
        Error main1.c: 2840 Syntax error; missing semicolon before
        `)'
        Error main1.c: 2840 skipping `)' `,'
        Warning main1.c: 2840 no type specified. Defaulting to int
        Error main1.c: 2840 too many errors
        cannot open main1.obj


        I have the latest & greatest lcc, downloaded Jan 27.

        What the hell is going on then ?! I am sending the files I
        just used...


        marcio
      • Thomas Aglassinger
        ... I tried it with SE -0.76 and SAS/c, and also get compiler errors. It seems that `run in MAIN causes the problem: run(file_name: STRING) is local cl :
        Message 3 of 25 , Feb 1, 2001
          On 01-Feb-01, Marcio Marchini wrote:

          > I compile like this: compile -clean -no_style_warning main
          > make
          >
          > and I still get this:
          >
          > Error main1.c: 2838 illegal expression
          > Error main1.c: 2838 syntax error; found `0' expecting `)'
          > [...]

          I tried it with SE -0.76 and SAS/c, and also get compiler errors.

          It seems that `run' in MAIN causes the problem:

          run(file_name: STRING) is
          local
          cl : MY_CLIENT;
          pair: INT_PAIR;
          do
          cl.make(file_name);
          from
          pair := cl.next_pair;
          until
          pair.is_null
          loop
          print("v1:");
          print(pair.v1);
          print("v2:");
          print(pair.v2);
          print("%R%N");
          pair := cl.next_pair;
          end; -- loop
          end -- run

          Apparently, the line

          pair := cl.next_pair;

          results into the C code

          _pair=(se_evobt(_cl,35657514),{0,0});

          In MY_CLIENT, `next_pair' is declared as

          next_pair: INT_PAIR is
          do
          Result.set_values(0,0);
          end

          Which to some extent would explain the {0,0} in C, especially
          considering that INT_PAIR is an expanded class. However, se_evobt()
          seems to be the check to detect `Void' routine calls, where `_cl' is
          the object to check, and 35657514 is the encoded position in the
          source code:

          void se_evobt(void*o,se_position position) {
          /*
          Error Void Or Bad Type.
          */
          if (!o) {
          #ifdef SE_EXCEPTIONS
          internal_exception_handler(Void_call_target);
          #else
          error1("Target is Void.",position);
          #endif
          }
          else {
          #ifdef SE_EXCEPTIONS
          internal_exception_handler(Void_call_target);
          #else
          error2(((T0*)o),position);
          #endif
          }
          }

          As se_evobt() is a C procedure (AKA "function returning void"), it
          does not make sense to use it in an assignment.

          To me it seems this is a bug in the C code generator. I think it
          should generate something like

          _se_evobt(_cl,35657514);
          _pair=(_{0,0});

          Regards,

          Thomas.
        • Marcio Marchini
          Good, I am not crazy :-) If you make that class non-expanded (and change the calling code accordingly) you will see that the C code compiles ok. marcio
          Message 4 of 25 , Feb 1, 2001
            Good, I am not crazy :-)


            If you make that class non-expanded (and change the calling
            code accordingly) you will see that the C code compiles ok.


            marcio


            > -----Original Message-----
            > From: Thomas Aglassinger [mailto:agi@...]
            > Sent: February 1, 2001 1:17 PM
            > To: smalleiffel@...
            > Subject: Re: -boost crashes, -no_check doesn't
            >
            >
            > On 01-Feb-01, Marcio Marchini wrote:
            >
            > > I compile like this: compile -clean
            > -no_style_warning main
            > > make
            > >
            > > and I still get this:
            > >
            > > Error main1.c: 2838 illegal expression
            > > Error main1.c: 2838 syntax error; found `0'
            > expecting `)'
            > > [...]
            >
            > I tried it with SE -0.76 and SAS/c, and also get
            > compiler errors.
            >
            > It seems that `run' in MAIN causes the problem:
            >
            > run(file_name: STRING) is
            > local
            > cl : MY_CLIENT;
            > pair: INT_PAIR;
            > do
            > cl.make(file_name);
            > from
            > pair := cl.next_pair;
            > until
            > pair.is_null
            > loop
            > print("v1:");
            > print(pair.v1);
            > print("v2:");
            > print(pair.v2);
            > print("%R%N");
            > pair := cl.next_pair;
            > end; -- loop
            > end -- run
            >
            > Apparently, the line
            >
            > pair := cl.next_pair;
            >
            > results into the C code
            >
            > _pair=(se_evobt(_cl,35657514),{0,0});
            >
            > In MY_CLIENT, `next_pair' is declared as
            >
            > next_pair: INT_PAIR is
            > do
            > Result.set_values(0,0);
            > end
            >
            > Which to some extent would explain the {0,0} in
            > C, especially
            > considering that INT_PAIR is an expanded class.
            > However, se_evobt()
            > seems to be the check to detect `Void' routine
            > calls, where `_cl' is
            > the object to check, and 35657514 is the encoded
            > position in the
            > source code:
            >
            > void se_evobt(void*o,se_position position) {
            > /*
            > Error Void Or Bad Type.
            > */
            > if (!o) {
            > #ifdef SE_EXCEPTIONS
            > internal_exception_handler(Void_call_target);
            > #else
            > error1("Target is Void.",position);
            > #endif
            > }
            > else {
            > #ifdef SE_EXCEPTIONS
            > internal_exception_handler(Void_call_target);
            > #else
            > error2(((T0*)o),position);
            > #endif
            > }
            > }
            >
            > As se_evobt() is a C procedure (AKA "function
            > returning void"), it
            > does not make sense to use it in an assignment.
            >
            > To me it seems this is a bug in the C code
            > generator. I think it
            > should generate something like
            >
            > _se_evobt(_cl,35657514);
            > _pair=(_{0,0});
            >
            > Regards,
            >
            > Thomas.
            >
            >
          • Marcio Marchini
            You re absolutely right, you nailed it. In main.e, my original source in run had this: cl.make(file_name); but since cl is not an expanded type, it should be
            Message 5 of 25 , Feb 4, 2001
              You're absolutely right, you nailed it.

              In main.e, my original source in "run" had this:

              cl.make(file_name);

              but since cl is not an expanded type, it should be this
              (as you said)

              !!cl.make(file_name);


              The question now is if this is a compile-time error that SE
              should catch (because it is not catching !!) or if it should
              just be a runtime error (call on a void target ?), in which
              case it is probably SE generating incorrect C code.

              Anyway, so far we have 2 code generation problems:

              1) the old message I sent, which you just nailed
              (expanded/non-expanded, !! not being used when it should)
              result: does not C-compile under lcc


              2) ?= when ?= is not needed, when in -boost mode
              result: crash


              Thanks for your help !!!


              marcio


              > -----Original Message-----
              > From: Kolari S. Bhat [mailto:kolari.s.bhat@...]
              > Sent: February 2, 2001 4:49 PM
              > To: mqm@...
              > Subject: Re: -boost crashes, -no_check doesn't
              >
              >
              > Marcio Marchini wrote:
              > >
              > > > Did the generated C code I sent you compile?
              > >
              > > Yes, with that warning regarding GRAPE,
              > which looked weird
              > > to me.
              >
              > I don't know the source of GRAPE warning. I
              > don't have GRAPE library in
              > my entire hard drive!
              > >
              > > More people are having the same problem
              > I have - did you
              > > see ?
              > >
              > > marcio
              >
              > I don't know, they might be right. I am just
              > learning programming as a
              > hobby.
              > I believe, that a reference type object needs to
              > call it's creation
              > routine; without 'creation' the object will be
              > void. I am not talking
              > about expanded class, INT_PAIR, but the other
              > class, MY_CLIENT. I
              > thought, the error was due to the fact that
              > object 'c1' was void and
              > therefore, calling c1.next_pair (calling a void
              > object's routine) was
              > the problem. When I added 'create' to c1, it
              > worked as shown below:
              >
              > class MAIN
              >
              > creation {ANY}
              > make
              >
              > feature {ANY}
              >
              > make is
              > do
              > run("foo");
              > end -- make
              >
              > run(file_name: STRING) is
              > local
              > cl : MY_CLIENT;
              > pair: INT_PAIR;
              >
              > do
              > create cl.make(file_name); -- <= Adding
              > 'create' works!
              >
              > from
              > pair := cl.next_pair;
              >
              > until
              > pair.is_null
              > loop
              > print("v1:");
              > print(pair.v1);
              > print("v2:");
              > print(pair.v2);
              > print("%R%N");
              > pair := cl.next_pair;
              > end; -- loop
              > end -- run
              >
              > end -- class MAIN
              >
              > It's possible, SE may not be displaying correct
              > warnings. Again, I
              > don't know enough to give you a more accurate
              > reply. Hope, I didn't
              > misinform you,
              >
              > Regards,
              > Kolari
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.