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

Full log


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."





This bug report was last modified 1 year and 126 days ago.

Previous Next


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