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

mysterious assert-traceback pointing to string.ml

Expand Messages
  • Romeyke, Andreas
    Hello, By running an ocaml-program, I got the following message Fatal error: exception Assert_failure( foo/bar.ml , 183, 4) Raised at file string.ml , line
    Message 1 of 5 , May 4, 2010
      Hello,

      By running an ocaml-program, I got the following message

      Fatal error: exception Assert_failure("foo/bar.ml", 183, 4)
      Raised at file "string.ml", line 146, characters 25-34
      Called from file "string.ml", line 149, characters 16-42

      The problem is that in line 183 of "foo/bar.ml" an assertion is raised
      with:

      ...
      match b with
      baz -> do_something()
      | _ -> assert(false)
      ...

      Could you explain, why Ocaml is meant that the caller function will be
      in string.ml?

      I am using Ocaml 3.10.2 at the moment (Debian Linux, 64bit)


      Any hints?

      Bye Andreas

      --
      Andreas Romeyke
      - Abteilung Blindenschrift -
      Deutsche Zentralbücherei für Blinde zu Leipzig (DZB)
      Gustav-Adolf-Straße 7, 04105 Leipzig
      Tel: +49 341 7113-..., Fax: +49 341 7113-125
      Internet: www.dzb.de
      E-Mail: andreas.romeyke@...

      --
      --
      Diese e-mail wurde auf Spam und Viren mit Astaro Security Gateway geprueft.


      [Non-text portions of this message have been removed]
    • vincent
      ... Could you be more precise about b and baz ? V.
      Message 2 of 5 , May 4, 2010
        --- In ocaml_beginners@yahoogroups.com, "Romeyke, Andreas" <andreas.romeyke@...> wrote:
        > By running an ocaml-program, I got the following message
        >
        > Fatal error: exception Assert_failure("foo/bar.ml", 183, 4)
        > Raised at file "string.ml", line 146, characters 25-34
        > Called from file "string.ml", line 149, characters 16-42
        >
        > The problem is that in line 183 of "foo/bar.ml" an assertion is raised
        > with:
        >
        > ...
        > match b with
        > baz -> do_something()
        > | _ -> assert(false)
        > ...
        >
        > Could you explain, why Ocaml is meant that the caller function will be
        > in string.ml?

        Could you be more precise about 'b' and 'baz'?

        V.
      • Romeyke, Andreas
        Hello, ... type cmodel_t = RGB24 ... ;; type color_t = Color of (cmodel_t * int);; val rgb_of_gray : color_t - color_t val color_of_rgb : int - int - int
        Message 3 of 5 , May 5, 2010
          Hello,

          Am Dienstag, den 04.05.2010, 12:55 +0000 schrieb vincent:
          >
          >
          >
          > --- In ocaml_beginners@yahoogroups.com, "Romeyke, Andreas"
          > <andreas.romeyke@...> wrote:
          > > By running an ocaml-program, I got the following message
          > >
          > > Fatal error: exception Assert_failure("foo/bar.ml", 183, 4)
          > > Raised at file "string.ml", line 146, characters 25-34
          > > Called from file "string.ml", line 149, characters 16-42
          > >
          > > The problem is that in line 183 of "foo/bar.ml" an assertion is
          > raised
          > > with:
          > >
          > > ...
          > > match b with
          > > baz -> do_something()
          > > | _ -> assert(false)
          > > ...
          > >
          > > Could you explain, why Ocaml is meant that the caller function will
          > be
          > > in string.ml?
          >
          > Could you be more precise about 'b' and 'baz'?


          --- 8>< --- 8>< --- 8>< ---

          type cmodel_t =
          RGB24
          | Gray
          | Monochrome
          ;;

          type color_t = Color of (cmodel_t * int);;
          val rgb_of_gray : color_t -> color_t
          val color_of_rgb : int -> int -> int -> color_t

          --- 8>< --- 8>< --- 8>< ---

          let rgb_of_gray =
          function
          | Color(Gray, g) -> color_of_rgb g g g
          | _ -> assert(false) (* this is the alerted assertion, line 183 *)
          ;;

          Hope it helps..., the function was miscalled with:

          rgb_of_gray (Color(Monochrome, 0))

          Bye Andreas

          --
          Andreas Romeyke
          - Abteilung Blindenschrift -
          Deutsche Zentralbücherei für Blinde zu Leipzig (DZB)
          Gustav-Adolf-Straße 7, 04105 Leipzig
          Tel: +49 341 7113-..., Fax: +49 341 7113-125
          Internet: www.dzb.de
          E-Mail: andreas.romeyke@...


          [Non-text portions of this message have been removed]
        • vincent
          ... Sorry, but it does not help :) I really don t get how this trace might happen... V.
          Message 4 of 5 , May 5, 2010
            --- In ocaml_beginners@yahoogroups.com, "Romeyke, Andreas" <andreas.romeyke@...> wrote:
            >
            >(...)
            > Hope it helps..., the function was miscalled with:
            >
            > rgb_of_gray (Color(Monochrome, 0))

            Sorry, but it does not help :) I really don't get how this trace might happen...

            V.
          • Romeyke, Andreas
            Hello, ... Argl, the reason was so simple. I compiled my own code without debugging symbols. But the code of the core-libraries was. Therefore the backtrace
            Message 5 of 5 , May 12, 2010
              Hello,

              Am Mittwoch, den 05.05.2010, 10:06 +0000 schrieb vincent:

              > Sorry, but it does not help :) I really don't get how this trace might
              > happen...

              Argl, the reason was so simple. I compiled my own code without debugging
              symbols. But the code of the core-libraries was. Therefore the backtrace
              could only solve the symbols for the core-libraries.

              Sorry for your time...

              Bye Andreas

              --
              Andreas Romeyke
              - Abt. Blindenschrift, Zi. 161 -



              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.