View Issue Details

IDProjectCategoryView StatusLast Update
0000510LDMud 3.3LPC Compiler/Preprocessorpublic2018-01-29 21:57
ReporterGnomi Assigned Tolars 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformi686OSDebian GNU/LinuxOS Version3.1
Product Version3.3 
Fixed in Version3.3.717 
Summary0000510: Wrong linenumber information after two inline closures in the same function
DescriptionWhen inserting pending inline closures it is assumed, that stored_line (the line where the line number information leads to) is at the current line in the file, so that some LI_BACK entries have to be inserted. Usually the store_line_number_info() call at the beginning of the loop in insert_pending_inline_closures takes care of that. But store_line_number_info updates stored_line only when some bytes were inserted into the program code. In 3/4 of the cases this happens because of the inserted bytes for alignment. For the remaining fourth wrong line number information will be generated.

So at the beginning of the loop it should be also checked whether forward steps are necessary. A attached a patch that fixes this.

Greetings,
Gnomi.
Steps To ReproduceLoading the following file shows the division by zero error at line 16 (at not 23).

string fun()
{
    map(({}),(: $1+0 :))
      
      
        ;

   foreach(mapping m:

        filter(({}),(: $1 :)))

   {

      1+1;

   }

}

void create()
{
   0/0;
}
TagsNo tags attached.
Attached Files
prolang.linecounting.diff (984 bytes)   
Index: trunk/src/prolang.y
===================================================================
--- trunk/src/prolang.y	(Revision 2314)
+++ trunk/src/prolang.y	(Arbeitskopie)
@@ -4952,7 +4952,18 @@
             store_line_number_info();
             if (stored_lines > ict->start_line)
                 store_line_number_backward(stored_lines - ict->start_line);
+	    else 
+                while (stored_lines < ict->start_line)
+                {
+                    int lines;
 
+                    lines = ict->start_line - stored_lines;
+                    if (lines > LI_MAXEMPTY)
+                        lines = LI_MAXEMPTY;
+                    stored_lines += lines;
+                    byte_to_mem_block(A_LINENUMBERS, 256 - lines);
+                }
+
             FUNCTION(ict->function)->offset.pc = CURRENT_PROGRAM_SIZE + FUNCTION_PRE_HDR_SIZE;
             add_to_mem_block(A_PROGRAM, INLINE_PROGRAM_BLOCK(ict->start)
                             , ict->length);
prolang.linecounting.diff (984 bytes)   

Activities

lars

2007-11-11 17:36

reporter   ~0000577

Resolved - thanks for the patch.

Issue History

Date Modified Username Field Change
2007-08-23 03:20 Gnomi New Issue
2007-08-23 03:20 Gnomi File Added: prolang.linecounting.diff
2007-11-11 17:36 lars Status new => resolved
2007-11-11 17:36 lars Fixed in Version => 3.3.717
2007-11-11 17:36 lars Resolution open => fixed
2007-11-11 17:36 lars Assigned To => lars
2007-11-11 17:36 lars Note Added: 0000577
2009-04-14 12:14 zesstra Project LDMud => LDMud 3.3
2010-11-16 09:42 lars Source_changeset_attached => ldmud.git master 0f8e8320
2018-01-29 18:59 lars Source_changeset_attached => ldmud.git master 0f8e8320
2018-01-29 21:57 lars Source_changeset_attached => ldmud.git master 0f8e8320