Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-948

Compiler endless loop and OOM after upgrade to 22.0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 22.0
    • Fix Version/s: 22.0.2
    • Component/s: compiler
    • Labels:
      None

      Description

      After upgrade to 22.0 cannot compile old source file: compilers goes into endless loop and is killed by OOM.
      Here is a minimal example:

      -module(bug).
      -export([titl/2]).
      
      -record(mp4_media, {tracks = []}).
      -record(mp4_track, {title}).
      
      
      unzero(Bin) ->
        Len = size(Bin) - 1,
        case Bin of
          <<Bin2:Len/binary, 0>> -> unzero(Bin2);
          _ -> Bin
        end.
      
      
      titl(<<0, _Flags:24, N:32, Title1/binary>>, #mp4_media{tracks = Tracks} = Media) ->
        if
          N > 0 andalso N =< size(Tracks) ->
            #mp4_track{} = Track = element(N,Tracks),
            Tracks1 = setelement(N,Tracks,Track#mp4_track{title = unzero(Title1)}),
            Media#mp4_media{tracks = Tracks1};
          true ->
            Media
        end.
      

      I compile it via: erlc bug.erl

      It should be compiled in a 1-2 seconds, but on 22.0 compiler does not stops

        Attachments

          Activity

            People

            Assignee:
            bjorn Björn Gustavsson
            Reporter:
            maxlapshin Maksim Lapshin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: