emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs is not reproducible


From: Stefan Monnier
Subject: Re: Emacs is not reproducible
Date: Wed, 26 May 2021 16:58:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Glenn Morris [2021-05-25 14:03:52] wrote:
>>> It causes all tests in test/lisp/cedet/semantic-utest-ia.el to fail.
> FTR, I should have said "four", not "all".

OK, I think I found the culprit!

When `byte-compile-inline-expand` calls `byte-compile`, the nested
compilation may end up using the outer value of
`byte-optimize--lexvars` resulting in plain-old broken code.

In the case at hand, during compilation of
`semantic-analyze-find-tag-sequence-default` the call to
`semantic-tag-of-class-p` gets miscompiled because
`byte-optimize--lexvars` says that `tag` is known to be nil and that
info gets propagated to the body of `semantic-tag-of-class-p` (where
`tag` refers to another variable).

Matthias, could you try and see where byte-opt.el should let-bind
`byte-optimize--lexvars` to nil to avoid this problem?
I guess we could add it to `byte-compile-top-level`, but it would be
better if we could do it somewhere in `byte-opt.el`.

See sample session below for "the evidence".


        Stefan


% rm lisp/cedet/semantic/analyze.elc lisp/cedet/semantic/tag.elc; make -C lisp 
cedet/semantic/analyze.elc
make : on entre dans le répertoire « /home/monnier/src/emacs/trunk/lisp »
  ELC      cedet/semantic/analyze.elc
Byte-compiling for inlinling: semantic-tag-p
Byte-compiling for inlinling: semantic-tag-class
Source = (closure (t) (tag) "Return the class of TAG.
This is a symbol like `variable', `function', or `type'.
There is no limit to the symbols that may represent the class of a tag.
Each parser generates tags with classes defined by it.

For functional languages, typical tag classes are:

@table @code
@item type
Data types, named map for a memory block.
@item function
A function or method, or named execution location.
@item variable
A variable, or named storage for data.
@item include
Statement that represents a file from which more tags can be found.
@item package
Statement that declares this file's package name.
@item code
Code that has not name or binding to any other symbol, such as in a script.
@end table
" (nth 1 tag))
Byte-code = #[257 "\211A@\207" [] 2 "Return the class of TAG.
This is a symbol like `variable', `function', or `type'.
There is no limit to the symbols that may represent the class of a tag.
Each parser generates tags with classes defined by it.

For functional languages, typical tag classes are:

@table @code
@item type
Data types, named map for a memory block.
@item function
A function or method, or named execution location.
@item variable
A variable, or named storage for data.
@item include
Statement that represents a file from which more tags can be found.
@item package
Statement that declares this file's package name.
@item code
Code that has not name or binding to any other symbol, such as in a script.
@end table

(fn TAG)"]
lexvars = nil

Disass:
byte code:
  doc:  Return the class of TAG. ...
  args: (arg1)
0       dup       
1       cdr       
2       car       
3       return    

Byte-compiling for inlinling: semantic-tag-type
Byte-compiling for inlinling: semantic-tag-get-attribute
Byte-compiling for inlinling: semantic-tag-attributes
Byte-compiling for inlinling: semantic-tag-of-class-p
Source = (closure (t) (tag class) "Return non-nil if class of TAG is CLASS." 
(eq (semantic-tag-class tag) class))
Byte-code = #[514 "\211A@\262=\207" [] 4 "Return non-nil if class of TAG is 
CLASS.

(fn TAG CLASS)"]
lexvars = ((tagclass nil) (miniscope nil) (fname nil nil) (tagtype nil nil) 
(tag nil nil) (tmp t) (s nil))

Disass:
byte code:
  doc:  Return non-nil if class of TAG is CLASS. ...
  args: (arg1 arg2)
0       stack-ref 1
1       dup       
2       cdr       
3       car       
4       stack-set 1
6       stack-ref 1
7       eq        
8       return    

Byte-compiling for inlinling: semantic-tag-name
Byte-compiling for inlinling: semantic-tag
Byte-compiling for inlinling: semantic-tag-type-members
Byte-compiling for inlinling: semantic-tag-function-arguments




reply via email to

[Prev in Thread] Current Thread [Next in Thread]