unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Glenn Morris" <rgm@gnu.org>, "Mattias Engdegård" <mattiase@acm.org>
Cc: emacs-devel@gnu.org
Subject: Re: Emacs is not reproducible
Date: Wed, 26 May 2021 16:58:24 -0400	[thread overview]
Message-ID: <jwvr1htmdh6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <w0y2c2g06v.fsf@fencepost.gnu.org> (Glenn Morris's message of "Tue, 25 May 2021 14:03:52 -0400")

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	other threads:[~2021-05-26 20:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 15:28 Emacs is not reproducible Bone Baboon
2021-05-17 15:45 ` Alan Mackenzie
2021-05-17 15:55   ` Achim Gratz
2021-05-17 15:54 ` Eli Zaretskii
2021-05-17 16:40 ` Stefan Monnier
2021-05-23  3:31   ` Stefan Monnier
2021-05-23 23:52     ` Glenn Morris
2021-05-25 17:41       ` Stefan Monnier
2021-05-25 17:52         ` T.V Raman
2021-05-25 18:03         ` Glenn Morris
2021-05-26 20:58           ` Stefan Monnier [this message]
2021-05-27 12:24             ` Mattias Engdegård
2021-05-27 21:33               ` Stefan Monnier
2021-05-25 18:27         ` Basil L. Contovounesios
2021-05-27 21:32           ` Stefan Monnier
2021-05-28  9:00             ` Basil L. Contovounesios
2021-06-05 16:26               ` Warning in tramp.el (was: Emacs is not reproducible) Stefan Monnier
2021-06-06  6:42                 ` Warning in tramp.el Michael Albinus
2021-06-06 17:48                   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvr1htmdh6.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=mattiase@acm.org \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).