GNU bug report logs - #68851
30.0.50; Native comp: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Wed, 31 Jan 2024 13:48:01 UTC

Severity: normal

Found in version 30.0.50

To reply to this bug, email your comments to 68851 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Wed, 31 Jan 2024 13:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ihor Radchenko <yantar92 <at> posteo.net>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Wed, 31 Jan 2024 13:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Wed, 31 Jan 2024 13:50:42 +0000
Hello,

I just stumbled upon strange native compiler warning after defining the
following inliner:

(define-inline org-element--property-idx (property)
  "Return standard property index or nil."
  (declare (pure t))
  (inline-letevals (property)
    (plist-get
     org-element--standard-properties-idxs
     (inline-const-val property))))

⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner

This is on the latest Org mode main branch.

This looks like a bug unless I misunderstand something about inlined functions.

⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-property: Handler: org-element-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-property: Handler: org-element-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner


In GNU Emacs 30.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version
 3.24.39, cairo version 1.18.0) of 2024-01-30 built on localhost
Repository revision: 9de29fb5b0396cb3929bd5668604fda076ca5ec4
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101011
System Description: Gentoo Linux

Configured using:
 'configure JAVAC=/etc/java-config-2/current-system-vm/bin/javac'

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Wed, 31 Jan 2024 14:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>, Andrea Corallo <acorallo <at> gnu.org>
Cc: 68851 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50;
 Native comp: Optimization failure for org-element-property-raw:
 Handler: org-element-property-raw--inliner
Date: Wed, 31 Jan 2024 16:20:09 +0200
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Date: Wed, 31 Jan 2024 13:50:42 +0000
> 
> I just stumbled upon strange native compiler warning after defining the
> following inliner:
> 
> (define-inline org-element--property-idx (property)
>   "Return standard property index or nil."
>   (declare (pure t))
>   (inline-letevals (property)
>     (plist-get
>      org-element--standard-properties-idxs
>      (inline-const-val property))))
> 
> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
> 
> This is on the latest Org mode main branch.
> 
> This looks like a bug unless I misunderstand something about inlined functions.

Andrea, can you please help understand this warning?

> 
> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-property: Handler: org-element-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-property: Handler: org-element-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> 
> 
> In GNU Emacs 30.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version
>  3.24.39, cairo version 1.18.0) of 2024-01-30 built on localhost
> Repository revision: 9de29fb5b0396cb3929bd5668604fda076ca5ec4
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 11.0.12101011
> System Description: Gentoo Linux
> 
> Configured using:
>  'configure JAVAC=/etc/java-config-2/current-system-vm/bin/javac'
> 
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Wed, 31 Jan 2024 19:15:02 GMT) Full text and rfc822 format available.

Message #11 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 68851 <at> debbugs.gnu.org
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Wed, 31 Jan 2024 14:13:12 -0500
> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner

This looks like the warning emitted by `macroexp--compiler-macro` when
a compiler macro (here, generated by `define-inline`) signals an error.

This said, the warning should include (on the next line) the actual
error encountered.  Not sure why you don't seem to have that.

In any case the origin might be a bug in your code or in `inline.el`.

Is `org-element--standard-properties-idxs` defined at the time of
macro-expansion?  If not, that would explain the error because the macro
expansion will try to execute:

    (plist-get
     org-element--standard-properties-idxs
     (inline-const-val property))

and that will start by getting the value of
`org-element--standard-properties-idxs`.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Wed, 31 Jan 2024 19:45:01 GMT) Full text and rfc822 format available.

Message #14 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 68851 <at> debbugs.gnu.org
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Wed, 31 Jan 2024 19:47:54 +0000
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
>
> This looks like the warning emitted by `macroexp--compiler-macro` when
> a compiler macro (here, generated by `define-inline`) signals an error.
>
> This said, the warning should include (on the next line) the actual
> error encountered.  Not sure why you don't seem to have that.

I also thought so, but the problem only appears during native
compilation. Normal compilation works just fine.

> In any case the origin might be a bug in your code or in `inline.el`.
>
> Is `org-element--standard-properties-idxs` defined at the time of
> macro-expansion?

Yup:

(eval-and-compile ; make available during inline expansion

  (defconst org-element--standard-properties
    '( :begin :post-affiliated :contents-begin :contents-end :end :post-blank
       :secondary :mode :granularity
       :cached :org-element--cache-sync-key
       :robust-begin :robust-end
       :true-level
       :buffer :deferred
       :structure :parent)
    "Standard properties stored in every syntax node structure.
These properties are stored in an array pre-allocated every time a new
object is created.  Two exceptions are `anonymous' and `plain-text'
node types.")

  (defconst org-element--standard-properties-idxs
    (let (plist)
      (seq-do-indexed
       (lambda (property idx)
         (setq plist (plist-put plist property idx)))
       org-element--standard-properties)
      plist)
    "Property list holding standard indexes for `org-element--standard-properties'."))

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Fri, 02 Feb 2024 09:01:02 GMT) Full text and rfc822 format available.

Message #17 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ihor Radchenko <yantar92 <at> posteo.net>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Fri, 02 Feb 2024 04:00:13 -0500
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
>> From: Ihor Radchenko <yantar92 <at> posteo.net>
>> Date: Wed, 31 Jan 2024 13:50:42 +0000
>> 
>> I just stumbled upon strange native compiler warning after defining the
>> following inliner:
>> 
>> (define-inline org-element--property-idx (property)
>>   "Return standard property index or nil."
>>   (declare (pure t))
>>   (inline-letevals (property)
>>     (plist-get
>>      org-element--standard-properties-idxs
>>      (inline-const-val property))))
>> 
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
>> 
>> This is on the latest Org mode main branch.
>> 
>> This looks like a bug unless I misunderstand something about inlined functions.
>
> Andrea, can you please help understand this warning?
>
>> 
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-property: Handler: org-element-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-property: Handler: org-element-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
>> ⛔ Warning (comp): Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner

Hi, I can't investigate this directly before next week but I was
wondering:

Ihor have you tried compiling the compilation unit from command line
(using batch-byte-compile or batch-native-compile)?  If some dependency
is broken this should highlight it.

Thanks

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Fri, 02 Feb 2024 13:33:02 GMT) Full text and rfc822 format available.

Message #20 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Fri, 02 Feb 2024 13:35:27 +0000
Andrea Corallo <acorallo <at> gnu.org> writes:

>>> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
>>> 
>>> This is on the latest Org mode main branch.
>>> 
>>> This looks like a bug unless I misunderstand something about inlined functions.
> ...
>
> Ihor have you tried compiling the compilation unit from command line
> (using batch-byte-compile or batch-native-compile)?  If some dependency
> is broken this should highlight it.

batch-byte-compile does not emit any warnings.
batch-native-compile emits the same warning:

Compiling single /home/yantar92/Git/org-mode/lisp/org-element-ast.el...
Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
(void-function org-element--property-idx)
Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
(void-function org-element--property-idx)
Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
(void-function org-element--property-idx)
...

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Mon, 05 Feb 2024 15:11:02 GMT) Full text and rfc822 format available.

Message #23 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Mon, 05 Feb 2024 10:10:27 -0500
Ihor Radchenko <yantar92 <at> posteo.net> writes:

> Andrea Corallo <acorallo <at> gnu.org> writes:
>
>>>> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
>>>> 
>>>> This is on the latest Org mode main branch.
>>>> 
>>>> This looks like a bug unless I misunderstand something about inlined functions.
>> ...
>>
>> Ihor have you tried compiling the compilation unit from command line
>> (using batch-byte-compile or batch-native-compile)?  If some dependency
>> is broken this should highlight it.
>
> batch-byte-compile does not emit any warnings.
> batch-native-compile emits the same warning:
>
> Compiling single /home/yantar92/Git/org-mode/lisp/org-element-ast.el...
> Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
> (void-function org-element--property-idx)
> Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> (void-function org-element--property-idx)
> Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
> (void-function org-element--property-idx)
> ...

Okay I'll try to look at it this week.

Thanks

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Thu, 08 Feb 2024 18:51:01 GMT) Full text and rfc822 format available.

Message #26 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 13:49:53 -0500
Ihor Radchenko <yantar92 <at> posteo.net> writes:

> Andrea Corallo <acorallo <at> gnu.org> writes:
>
>>>> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
>>>> 
>>>> This is on the latest Org mode main branch.
>>>> 
>>>> This looks like a bug unless I misunderstand something about inlined functions.
>> ...
>>
>> Ihor have you tried compiling the compilation unit from command line
>> (using batch-byte-compile or batch-native-compile)?  If some dependency
>> is broken this should highlight it.
>
> batch-byte-compile does not emit any warnings.
> batch-native-compile emits the same warning:
>
> Compiling single /home/yantar92/Git/org-mode/lisp/org-element-ast.el...
> Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
> (void-function org-element--property-idx)
> Warning: Optimization failure for org-element-put-property: Handler: org-element-put-property--inliner
> (void-function org-element--property-idx)
> Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
> (void-function org-element--property-idx)
> ...

Hi Ihor,

could you specify the reproducer for this?

Thanks

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Thu, 08 Feb 2024 19:19:02 GMT) Full text and rfc822 format available.

Message #29 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 19:21:16 +0000
Andrea Corallo <acorallo <at> gnu.org> writes:

>> Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
>> (void-function org-element--property-idx)
>> ...
> ...
> could you specify the reproducer for this?

git clone --depth 1 git://git.savannah.gnu.org/emacs/org-mode.git
cd org-mode
make native

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Thu, 08 Feb 2024 21:44:02 GMT) Full text and rfc822 format available.

Message #32 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 16:43:18 -0500
Ihor Radchenko <yantar92 <at> posteo.net> writes:

> Andrea Corallo <acorallo <at> gnu.org> writes:
>
>>> Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
>>> (void-function org-element--property-idx)
>>> ...
>> ...
>> could you specify the reproducer for this?
>
> git clone --depth 1 git://git.savannah.gnu.org/emacs/org-mode.git
> cd org-mode
> make native

Thanks,

how can I ask this makefile to dump Emacs the command line invocation?

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Thu, 08 Feb 2024 21:49:02 GMT) Full text and rfc822 format available.

Message #35 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 21:51:38 +0000
Andrea Corallo <acorallo <at> gnu.org> writes:

>> git clone --depth 1 git://git.savannah.gnu.org/emacs/org-mode.git
>> cd org-mode
>> make native
>
> Thanks,
>
> how can I ask this makefile to dump Emacs the command line invocation?

make -n native

or
cd lisp
emacs  -Q -batch --eval '(setq vc-handled-backends nil org-startup-folded nil org-element-cache-persistent nil)' --eval '(add-to-list '"'"'load-path ".")' --eval '(batch-native-compile)' org-element-ast.el

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Thu, 08 Feb 2024 22:11:02 GMT) Full text and rfc822 format available.

Message #38 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 22:13:25 +0000
Andrea Corallo <acorallo <at> gnu.org> writes:

> Sorry I'm not too excited about reverse engineering org makefile :)

You can simply

cd org-mode/lisp
emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval '(batch-native-compile)' org-element-ast.el


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Thu, 08 Feb 2024 22:22:02 GMT) Full text and rfc822 format available.

Message #41 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 16:57:05 -0500
Ihor Radchenko <yantar92 <at> posteo.net> writes:

> Andrea Corallo <acorallo <at> gnu.org> writes:
>
>>> git clone --depth 1 git://git.savannah.gnu.org/emacs/org-mode.git
>>> cd org-mode
>>> make native
>>
>> Thanks,
>>
>> how can I ask this makefile to dump Emacs the command line invocation?
>
> make -n native

-n works for native compilation but not for the byte compilation (make
 -n).

Sorry I'm not too excited about reverse engineering org makefile :)

Thanks

  Andrea





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Thu, 08 Feb 2024 22:35:01 GMT) Full text and rfc822 format available.

Message #44 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 17:33:44 -0500
Ihor Radchenko <yantar92 <at> posteo.net> writes:

> Andrea Corallo <acorallo <at> gnu.org> writes:
>
>> Sorry I'm not too excited about reverse engineering org makefile :)
>
> You can simply
>
> cd org-mode/lisp
> emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval '(batch-native-compile)' org-element-ast.el

Negative, I've already the invocation for the native compilation, what I
want is the one for byte compilation.

Reason for that is that my crystal ball suggests compilers are invoked
in different ways.  Actually

emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval '(batch-byte-compile)' org-element-ast.el

gives here the same exact error the native compiler gives.

That BTW is in disagreement with:

>> Ihor have you tried compiling the compilation unit from command line
>> (using batch-byte-compile or batch-native-compile)?  If some dependency
>> is broken this should highlight it.
>
> batch-byte-compile does not emit any warnings.
> batch-native-compile emits the same warning:

So I suspect that (if this is really a bug) is not native compiler
related, but I need the second invocation to confirm.

Thanks

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Thu, 08 Feb 2024 23:04:01 GMT) Full text and rfc822 format available.

Message #47 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 23:06:52 +0000
Andrea Corallo <acorallo <at> gnu.org> writes:

>> cd org-mode/lisp
>> emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval '(batch-native-compile)' org-element-ast.el
>
> Negative, I've already the invocation for the native compilation, what I
> want is the one for byte compilation.
>
> Reason for that is that my crystal ball suggests compilers are invoked
> in different ways.  Actually
>
> emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval '(batch-byte-compile)' org-element-ast.el
>
> gives here the same exact error the native compiler gives.

I confirm.

> That BTW is in disagreement with:
>
>>> Ihor have you tried compiling the compilation unit from command line
>>> (using batch-byte-compile or batch-native-compile)?  If some dependency
>>> is broken this should highlight it.
>>
>> batch-byte-compile does not emit any warnings.
>> batch-native-compile emits the same warning:

Hmm. I think what I tried was a bit different. I did make compile, which
is using batch-byte-recompile-directory:

emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval '(batch-byte-recompile-directory 0)'

> So I suspect that (if this is really a bug) is not native compiler
> related, but I need the second invocation to confirm.

Looks like it is really not native compiler related.
Still, I am puzzled what is going wrong there. The error is

Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
(void-function org-element--property-idx)

but both org-element--property-idx and org-element-property-raw are
inline functions defined in the same file.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Thu, 08 Feb 2024 23:41:02 GMT) Full text and rfc822 format available.

Message #50 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrea Corallo <acorallo <at> gnu.org>,
 68851 <at> debbugs.gnu.org
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 23:42:53 +0000
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval
>> '(batch-byte-recompile-directory 0)'
>
> I like to use ` to avoid that quotation gymnastics:
>
>     emacs  -Q -batch --eval '(add-to-list `load-path ".")' ...

Interesting. Thanks for sharing the trick.

>> Looks like it is really not native compiler related.
>> Still, I am puzzled what is going wrong there. The error is
>>
>> Warning: Optimization failure for org-element-property-raw: Handler:
>> org-element-property-raw--inliner
>> (void-function org-element--property-idx)
>>
>> but both org-element--property-idx and org-element-property-raw are
>> inline functions defined in the same file.
>
> `org-element--property-idx` is defined in that same file, indeed, but
> contrary to `defmacro`, `define-inline` does not make the function
> usable during that same file's compilation.

This is surprising. I would not mind compiler indicating this fact in
less cryptic way or, better, making `define-inline' usable during file's
compilation.

Also, I am very confused because the previous version worked:

(define-inline org-element--property-idx (property)
  "Return standard property index or nil."
  (declare (pure t))
  (if (inline-const-p property)
      (plist-get
       org-element--standard-properties-idxs
       (inline-const-val property))
    (inline-quote (plist-get
                   org-element--standard-properties-idxs
                   ,property))))

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Fri, 09 Feb 2024 00:27:02 GMT) Full text and rfc822 format available.

Message #53 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrea Corallo <acorallo <at> gnu.org>,
 68851 <at> debbugs.gnu.org
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 18:30:45 -0500
Ihor Radchenko [2024-02-08 23:06:52] wrote:

> Andrea Corallo <acorallo <at> gnu.org> writes:
>
>>> cd org-mode/lisp
>>> emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval
>>> '(batch-native-compile)' org-element-ast.el
>>
>> Negative, I've already the invocation for the native compilation, what I
>> want is the one for byte compilation.
>>
>> Reason for that is that my crystal ball suggests compilers are invoked
>> in different ways.  Actually
>>
>> emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval
>> '(batch-byte-compile)' org-element-ast.el
>>
>> gives here the same exact error the native compiler gives.
>
> I confirm.
>
>> That BTW is in disagreement with:
>>
>>>> Ihor have you tried compiling the compilation unit from command line
>>>> (using batch-byte-compile or batch-native-compile)?  If some dependency
>>>> is broken this should highlight it.
>>>
>>> batch-byte-compile does not emit any warnings.
>>> batch-native-compile emits the same warning:
>
> Hmm. I think what I tried was a bit different. I did make compile, which
> is using batch-byte-recompile-directory:
>
> emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval
> '(batch-byte-recompile-directory 0)'

I like to use ` to avoid that quotation gymnastics:

    emacs  -Q -batch --eval '(add-to-list `load-path ".")' ...

> Looks like it is really not native compiler related.
> Still, I am puzzled what is going wrong there. The error is
>
> Warning: Optimization failure for org-element-property-raw: Handler:
> org-element-property-raw--inliner
> (void-function org-element--property-idx)
>
> but both org-element--property-idx and org-element-property-raw are
> inline functions defined in the same file.

`org-element--property-idx` is defined in that same file, indeed, but
contrary to `defmacro`, `define-inline` does not make the function
usable during that same file's compilation.

IOW, you can work around that problem with `eval-and-compile`, for example.


        Stefan


diff --git a/lisp/org-element-ast.el b/lisp/org-element-ast.el
index b624fd1c87..0079334bca 100644
--- a/lisp/org-element-ast.el
+++ b/lisp/org-element-ast.el
@@ -350,13 +350,14 @@ node types.")
       plist)
     "Property list holding standard indexes for `org-element--standard-properties'."))
 
-(define-inline org-element--property-idx (property)
+(eval-and-compile
+  (define-inline org-element--property-idx (property)
   "Return standard property index or nil."
   (declare (pure t))
   (inline-letevals (property)
     (plist-get
      org-element--standard-properties-idxs
-     (inline-const-val property))))
+     (inline-const-val property)))))
 
 (define-inline org-element--parray (node)
   "Return standard property array for NODE."





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Fri, 09 Feb 2024 00:57:02 GMT) Full text and rfc822 format available.

Message #56 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrea Corallo <acorallo <at> gnu.org>,
 68851 <at> debbugs.gnu.org
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 19:47:57 -0500
>> `org-element--property-idx` is defined in that same file, indeed, but
>> contrary to `defmacro`, `define-inline` does not make the function
>> usable during that same file's compilation.
> This is surprising. I would not mind compiler indicating this fact in
> less cryptic way or, better, making `define-inline' usable during file's
> compilation.

The same error would be signaled if `org-element--property-idx` were
defined with `defun`, and `define-inline` is another way to define
a function, so I thought it would make sense to make them
behave similarly.

> Also, I am very confused because the previous version worked:
>
> (define-inline org-element--property-idx (property)
>   "Return standard property index or nil."
>   (declare (pure t))
>   (if (inline-const-p property)
>       (plist-get
>        org-element--standard-properties-idxs
>        (inline-const-val property))
>     (inline-quote (plist-get
>                    org-element--standard-properties-idxs
>                    ,property))))

I can't see why it would behave differently with the above
definition, sorry.
BTW, improved patch below.


        Stefan


diff --git a/lisp/org-element-ast.el b/lisp/org-element-ast.el
index b624fd1c87..9a12299b60 100644
--- a/lisp/org-element-ast.el
+++ b/lisp/org-element-ast.el
@@ -348,7 +348,7 @@ node types.")
          (setq plist (plist-put plist property idx)))
        org-element--standard-properties)
       plist)
-    "Property list holding standard indexes for `org-element--standard-properties'."))
+    "Property list holding standard indexes for `org-element--standard-properties'.")
 
 (define-inline org-element--property-idx (property)
   "Return standard property index or nil."
@@ -356,7 +356,7 @@ node types.")
   (inline-letevals (property)
     (plist-get
      org-element--standard-properties-idxs
-     (inline-const-val property))))
+     (inline-const-val property)))))
 
 (define-inline org-element--parray (node)
   "Return standard property array for NODE."
@@ -405,26 +405,15 @@ Ignore standard property array."
 Do not resolve deferred values.
 If PROPERTY is not present, return DFLT."
   (declare (pure t))
-  (let ((idx (and (inline-const-p property)
-                  (org-element--property-idx property))))
-    (if idx
-        (inline-letevals (node)
-          (inline-quote
-           (if-let ((parray (org-element--parray ,node)))
-               (pcase (aref parray ,idx)
-                 (`org-element-ast--nil ,dflt)
-                 (val val))
-             ;; No property array exists.  Fall back to `plist-get'.
-             (org-element--plist-property ,property ,node ,dflt))))
-      (inline-letevals (node property)
-        (inline-quote
-         (let ((idx (org-element--property-idx ,property)))
-           (if-let ((parray (and idx (org-element--parray ,node))))
-               (pcase (aref parray idx)
-                 (`org-element-ast--nil ,dflt)
-                 (val val))
-             ;; No property array exists.  Fall back to `plist-get'.
-             (org-element--plist-property ,property ,node ,dflt))))))))
+  (let ((idx (org-element--property-idx (inline-const-val property))))
+    (inline-letevals (node)
+      (inline-quote
+       (if-let ((parray (org-element--parray ,node)))
+           (pcase (aref parray ,idx)
+             (`org-element-ast--nil ,dflt)
+             (val val))
+         ;; No property array exists.  Fall back to `plist-get'.
+         (org-element--plist-property ,property ,node ,dflt))))))
 
 (define-inline org-element--put-parray (node &optional parray)
   "Initialize standard property array in NODE.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Fri, 09 Feb 2024 11:42:02 GMT) Full text and rfc822 format available.

Message #59 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68851 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Fri, 09 Feb 2024 06:41:03 -0500
Ihor Radchenko <yantar92 <at> posteo.net> writes:

> Andrea Corallo <acorallo <at> gnu.org> writes:
>
>>> cd org-mode/lisp
>>> emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval '(batch-native-compile)' org-element-ast.el
>>
>> Negative, I've already the invocation for the native compilation, what I
>> want is the one for byte compilation.
>>
>> Reason for that is that my crystal ball suggests compilers are invoked
>> in different ways.  Actually
>>
>> emacs  -Q -batch --eval '(add-to-list '"'"'load-path ".")' --eval '(batch-byte-compile)' org-element-ast.el
>>
>> gives here the same exact error the native compiler gives.
>
> I confirm.
>
>> That BTW is in disagreement with:
>>
>>>> Ihor have you tried compiling the compilation unit from command line
>>>> (using batch-byte-compile or batch-native-compile)?  If some dependency
>>>> is broken this should highlight it.
>>>
>>> batch-byte-compile does not emit any warnings.
>>> batch-native-compile emits the same warning:
>
> Hmm. I think what I tried was a bit different. I did make compile, which
> is using batch-byte-recompile-directory:

Please verify and compare your real compiler invocation next time,
that's essential to reporting and triaging a bug.

Thanks

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Fri, 09 Feb 2024 12:00:03 GMT) Full text and rfc822 format available.

Message #62 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrea Corallo <acorallo <at> gnu.org>,
 68851 <at> debbugs.gnu.org
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Fri, 09 Feb 2024 12:02:56 +0000
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> `org-element--property-idx` is defined in that same file, indeed, but
>>> contrary to `defmacro`, `define-inline` does not make the function
>>> usable during that same file's compilation.
>> This is surprising. I would not mind compiler indicating this fact in
>> less cryptic way or, better, making `define-inline' usable during file's
>> compilation.
>
> The same error would be signaled if `org-element--property-idx` were
> defined with `defun`, and `define-inline` is another way to define
> a function, so I thought it would make sense to make them
> behave similarly.

I see the logic.
Although, I am very surprised that `batch-byte-recompile-directory' does
not trigger the error. So, something is off somewhere in the
compilation. If not in `batch-byte-compile' then in
`batch-byte-recompile-directory'.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Fri, 09 Feb 2024 12:44:01 GMT) Full text and rfc822 format available.

Message #65 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrea Corallo <acorallo <at> gnu.org>,
 68851 <at> debbugs.gnu.org
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Fri, 09 Feb 2024 07:42:41 -0500
> Although, I am very surprised that `batch-byte-recompile-directory' does
> not trigger the error. So, something is off somewhere in the
> compilation. If not in `batch-byte-compile' then in
> `batch-byte-recompile-directory'.

`batch-byte-recompile-directory` runs a single Emacs session that
compiles all the files.  Some of those files probably (require
'org-element-ast) and presumably this happens in one of the files
compiled *before* `org-element-ast.el`, hence the problem disappears.

FWIW, I have a local hack which saves&restores the global `obarray`
around each `byte-compile-file` which should make
`batch-byte-recompile-directory` shows the same errors as compiling each
file individually.  Not sure it's worth the trouble, tho.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Fri, 09 Feb 2024 16:24:01 GMT) Full text and rfc822 format available.

Message #68 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrea Corallo <acorallo <at> gnu.org>,
 68851 <at> debbugs.gnu.org
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Fri, 09 Feb 2024 16:19:27 +0000
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> BTW, improved patch below.

Thanks!

> diff --git a/lisp/org-element-ast.el b/lisp/org-element-ast.el
> index b624fd1c87..9a12299b60 100644
> --- a/lisp/org-element-ast.el
> +++ b/lisp/org-element-ast.el
> @@ -348,7 +348,7 @@ node types.")
>           (setq plist (plist-put plist property idx)))
>         org-element--standard-properties)
>        plist)
> -    "Property list holding standard indexes for `org-element--standard-properties'."))
> +    "Property list holding standard indexes for `org-element--standard-properties'.")
>  
>  (define-inline org-element--property-idx (property)
>    "Return standard property index or nil."
> @@ -356,7 +356,7 @@ node types.")
>    (inline-letevals (property)
>      (plist-get
>       org-element--standard-properties-idxs
> -     (inline-const-val property))))
> +     (inline-const-val property)))))

I applied this part, as
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ecb5b605d
  
>  (define-inline org-element--parray (node)
>    "Return standard property array for NODE."
> @@ -405,26 +405,15 @@ Ignore standard property array."
>  Do not resolve deferred values.
>  If PROPERTY is not present, return DFLT."
>    (declare (pure t))
> -  (let ((idx (and (inline-const-p property)
> ...
> +  (let ((idx (org-element--property-idx (inline-const-val property))))
> +    (inline-letevals (node)
> +      (inline-quote
> +       (if-let ((parray (org-element--parray ,node)))
> +           (pcase (aref parray ,idx)
> +             (`org-element-ast--nil ,dflt)
> +             (val val))
> +         ;; No property array exists.  Fall back to `plist-get'.
> +         (org-element--plist-property ,property ,node ,dflt))))))

This one causes failing tests. So, something is off.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68851; Package emacs. (Fri, 09 Feb 2024 16:34:01 GMT) Full text and rfc822 format available.

Message #71 received at 68851 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrea Corallo <acorallo <at> gnu.org>,
 68851 <at> debbugs.gnu.org
Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for
 org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Fri, 09 Feb 2024 16:21:48 +0000
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> Although, I am very surprised that `batch-byte-recompile-directory' does
>> not trigger the error. So, something is off somewhere in the
>> compilation. If not in `batch-byte-compile' then in
>> `batch-byte-recompile-directory'.
>
> `batch-byte-recompile-directory` runs a single Emacs session that
> compiles all the files.  Some of those files probably (require
> 'org-element-ast) and presumably this happens in one of the files
> compiled *before* `org-element-ast.el`, hence the problem disappears.

Makes sense. Then, this bug can be closed I think. The problem is not on
Emacs side.

> FWIW, I have a local hack which saves&restores the global `obarray`
> around each `byte-compile-file` which should make
> `batch-byte-recompile-directory` shows the same errors as compiling each
> file individually.  Not sure it's worth the trouble, tho.

I prefer to be explicit.
I changed Org mode build system to use "single" target by default, so
that .el files are compiled individually.
This also allowed parallel execution of make.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=71fbe92c2
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c76d498f4

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




This bug report was last modified 84 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.