I'm on a macOS M1 (ARM) platfform, c++ --version
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Volumes/MyPassport/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
What I'm seeing is independent of compliation systems, operating systems, and CPU architectures. I've had good luck by editing the GNU APL src.Performance.def and changing the FT_LABEL_LITERAL optimixation macro from
optim(FT_ANY, FT_LABEL_LITERAL, "⎕FX Time: Label to integer literal") // 0
to
optim(0, FT_LABEL_LITERAL, "⎕FX Time: Label to integer literal") // 0
then recompiling. I haven't seen the bogus SYNTAX ERROR since I did that.
Here's what I do to override the CFLAGS in ./configure: I have this placed in a shell script so that I can build without GTK3, force my compiler to use C++17 with GNU extentions language syntax (Apple's C++ compiler defaults to C++98, and I want to use the dialect that is closest to what gcc provides on current Linux platforms), add a compiler options to eliminate some implicit conversion warnings, and add libraries and headers that reside in non-standard locations.
./configure --without-gtk3 CXXFLAGS="-O2 -Wno-narrowing -I/opt/local/include -std=gnu++17" LDFLAGS="-L/opt/local/lib"
- paul
On Feb 11, 2025, at 9:21 PM, Blake McBride <blake1024@gmail.com> wrote:
In case the version of GCC I am using is meaningful, I am using version 14.2.1
(But since others are seeing the same issues, perhaps the particular version isn't meaningful.)
Thanks!
Blake
When I do ./configure, the created Makefiles contain CFLAGS with -O2.
I tried:
CFLAGS="-Od" ./configure
and
./configure CLAGS="-Od"
Neither works. What should I be doing to override CLAGS?
Thanks.
Blake
I might have another clue as to what's going on.
By process of controlled trial and error, I find that disabling the following optimization in src/Performance.def makes the SYNTAX ERROR go away:
// select optimizations. Use 0 or 1 for individual optimizations or // FT_ANY or RT_ANY to enable ebntire groups (in file Performance.hh) // optim(0, FT_LABEL_LITERAL, "⎕FX Time: Label to integer literal") // 0 optim(FT_ANY, FT_DIRECT_BRANCHES, "⎕FX Time: Unconditional branches" ) // 1 optim(FT_ANY, FT_LITERAL_AXIS, "⎕FX Time: Literal axis [X]" ) // 2 optim(FT_ANY, FT_LITERAL_INDEX, "⎕FX Time: Literal index [X1;...]" ) // 3 optim(FT_ANY, FT_SHORT_PRIMITIVE, "⎕FX Time: Short primitives" ) // 4 optim(RT_ANY, RT_A_RHO_B, "Run Time: In-place A⍴B" ) // 5 optim(RT_ANY, RT_COMMA_B, "Run Time: In-place ,B" ) // 6 optim(RT_ANY, RT_COMMA1_B, "Run Time: In-place ⍪B" ) // 7
Might be worth a look at what that optimization turns on.
- paul
Well, I'm knee deep in the debugger on this one.
Here's an instance of the error:
E∆Edit 'asd'
At all prompts you can type 'end' to exit or backup to the previous question. You can often type 'help' to get help.
Enter your edit command? edit Enter the line numbers you wish to change, or [a,b,r]? 2 SYNTAX ERROR E∆Piv[18] →(0=⍴t)/0 ^^ The error is getting thrown by function Prefiix::reduce_END_GOTO() at line 1689:
2687 Assert1(prefix_len == 2); 2688 2689 if (size() != 2) syntax_error(LOC); 2690 2691 si.fun_oper_cache.reset(); The value returned by size() is 3, hence the thowing of the error.
Here's the interesting part.
Now open the offending function with the ∇ editor
)reset ∇E∆Piv [51] ∇ E∆Edit 'asd'
At all prompts you can type 'end' to exit or backup to the previous question. You can often type 'help' to get help.
Enter your edit command? edit Enter the line numbers you wish to change, or [a,b,r]? 2 262144 24 ,524288 524288 262144 24
Enter your edit command? save asd saved. Enter your edit command? end
As you can see, the function now works properly. The breakpoint I set to trap this in Prefiix::reduce_END_GOTO() is not being hit. Something changed in the function's tokens based on re-establishing the function using the editor. Perhaps something with optimizations?
Oh by the way, I've encountered at least two instances of out-of-bounds array access. The compiliation system I'm using on macOS turned runtime array bounds checking on by default.
I'll see if I can get an idea where and why reduce_END_GOTO is being called in one instance and not the other. Perhaps this a result of goto opetimizations that may be happening? It's seeming to be burined deep in the innards of the parser...
- paul
Since these problems didn't exist in the past, I could do a binary commit search and find out which change created the problem. Would that be helpful?
Thanks.
Blake
Hi Hans-Peter,
thanks, that helps. I will have a closer look.
Best Regards,
Jürgen
On 2/11/25 15:12, Hans-Peter Sorge
wrote:
shorts and more ...
1. create function emacs
workspaces/WWW.apl
#!/usr/local/bin/apl --script
⎕FX ⎕INP '⍝∆∆∆'
WWW
ws←3↓1⊃⍎')WSID'
→
x
x:
marker ←
⊂'⍝','∆∆∆'
⍝∆∆∆
2. In apl:
)clear
CLEAR WS
)copy
WWW
DUMPED
2025-02-11 15:00:26 (GMT+1)
WWW
WWW
SYNTAX
ERROR
WWW[4]
marker←⊂'⍝','∆∆∆' ⍝the command itself executes w/o SYNTAX ERROR
^
^
)reset
∇WWW∇
WWW
marker
⍝∆∆∆
⍝
-------------------------------------------------------------------------------------------------------------
3. Modify workspaces/WWW.apl
(⍝→ x) :
#!/usr/local/bin/apl --script
⎕FX ⎕INP '⍝∆∆∆'
WWW
ws←3↓1⊃⍎')WSID'
⍝→ x
x:
marker ←
⊂'⍝','∆∆∆'
⍝∆∆∆
4. In apl
)clear
CLEAR WS
)copy
WWW
DUMPED
2025-02-11 15:06:53 (GMT+1)
WWW
WWW
marker
⍝∆∆∆
Best Regards
Hans-Peter
Am 10.02.25 um 22:46 schrieb
Hans-Peter Sorge:
OK - Back to the drawing board ....
apl
⍝ Assertion:
⍝ The sequence of bold commands seems to be required to
produce the stack trace
⍝ If I left out either
⍝ the 2nd )copy
Editor
⍝ or EEE←⎕CR
'E∆Edit'
⍝ or T∆E∆Edit
←⍳0
⍝ to shorten the
cause for the stack trace the SYNTAX ERROR
was gone.
∇x
[1]
'xxxxxxxxx'
[2] ∇
)copy Editor
SAVED
2025-02-10 09:15:01 (GMT-6)
E∆Edit
'x'
At all
prompts you can type 'end' to exit or backup to the previous
question.
You can
often type 'help' to get help.
Enter
your edit command? help
Enter
your edit command? help
SYNTAX
ERROR
E∆Edit[31]
→(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
^^
)reset
)copy
Editor
SAVED
2025-02-10 09:15:01 (GMT-6)
E∆Edit
'x'
At all
prompts you can type 'end' to exit or backup to the previous
question.
You can
often type 'help' to get help.
Enter
your edit command? help
Enter
your edit command? help
SYNTAX
ERROR
E∆Edit[31]
→(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
^^
T∆E∆Edit
←⍳0
)reset
)copy
Editor
SAVED
2025-02-10 09:15:01 (GMT-6)
E∆Edit
'x'
At all
prompts you can type 'end' to exit or backup to the previous
question.
You can
often type 'help' to get help.
Enter
your edit command? help
Enter
your edit command? help
SYNTAX
ERROR
E∆Edit[31]
→(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
^^
)reset
EEE←⎕CR 'E∆Edit'
E∆Edit 'x'
At all
prompts you can type 'end' to exit or backup to the previous
question.
You can
often type 'help' to get help.
Enter
your edit command? help
Enter
your edit command? help
SYNTAX
ERROR
E∆Edit[31]
→(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
^^
T∆E∆Edit ←⍳0
)reset
Symbol
is: 'EN0' at Symbol.cc:404
***
useless apl.lines (no CXXFLAGS=-rdynamic -gdwarf-2)
----------------------------------------
-- Stack
trace at Symbol.cc:405
----------------------------------------
0x7f3571d2a30b
__libc_start_main
0x7f3571d2a248
0x403dfd
main
0x5d2a8b
Workspace::immediate_execution(bool)
0x45ec89
Command::process_line()
0x45ee65
Command::process_line(UCS_string&, std::ostream*)
0x45fd25
Command::do_APL_command(std::ostream&,
UCS_string&)
0x5d4993
Workspace::clear_SI(std::ostream&)
0x5d2861
Workspace::pop_SI(char const*)
0x56abd3
StateIndicator::~StateIndicator()
0x56d0f4
UserFunction::pop_local_vars() const
0x5b9efc
UserFunction_header::pop_local_vars() const
0x5784f2
Symbol::pop()
========================================
========================================
----------------------------------------
-- Stack
trace at Symbol.cc:1310
----------------------------------------
0x7f3571d2a30b
__libc_start_main
0x7f3571d2a248
0x403dfd
main
0x5d2a8b
Workspace::immediate_execution(bool)
0x45ec89
Command::process_line()
0x45ee65
Command::process_line(UCS_string&, std::ostream*)
0x45fd25
Command::do_APL_command(std::ostream&,
UCS_string&)
0x5d4993
Workspace::clear_SI(std::ostream&)
0x5d2861
Workspace::pop_SI(char const*)
0x56abd3
StateIndicator::~StateIndicator()
0x56d0f4
UserFunction::pop_local_vars() const
0x5b9efc
UserFunction_header::pop_local_vars() const
0x578506
Symbol::pop()
0x7f3571d4378e
0x7f3571d436c1
0x5d931e
Workspace::~Workspace()
0x5d7466
Workspace_0::~Workspace_0()
0x5d73ee
SymbolTable::~SymbolTable()
0x5d7a38
SymbolTableBase<Symbol,
65536ul>::~SymbolTableBase()
0x41c562
Symbol::~Symbol()
0x41c526
Symbol::~Symbol()
0x57ba5e
Symbol::clear_vs()
========================================
========================================
⍝ Try to prove my
assertion:
apl
∇x
[1]
'xxxxx'
[2] ∇
)copy Editor
SAVED
2025-02-10 09:15:01 (GMT-6)
E∆Edit
'x'
At all
prompts you can type 'end' to exit or backup to the previous
question.
You can
often type 'help' to get help.
Enter
your edit command? help
Enter
your edit command? help
SYNTAX
ERROR
E∆Edit[31]
→(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
^^
)reset
E∆Edit 'x'
At all
prompts you can type 'end' to exit or backup to the previous
question.
You can
often type 'help' to get help.
Enter
your edit command? help
Enter
your edit command? help
SYNTAX
ERROR
E∆Edit[31]
→(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
^^
T∆E∆Edit
←⍳0
)reset
EEE←⎕CR 'E∆Edit'
E∆Edit 'x'
At all
prompts you can type 'end' to exit or backup to the previous
question.
You can
often type 'help' to get help.
Enter
your edit command? help
Enter
your edit command? help
Enter
your edit command? end
)clear
***
useless apl.lines (no CXXFLAGS=-rdynamic -gdwarf-2)
----------------------------------------
-- Stack
trace at Symbol.cc:1310
----------------------------------------
0x7f4e5521030b
__libc_start_main
0x7f4e55210248
0x403dfd
main
0x5d2a8b
Workspace::immediate_execution(bool)
0x45ec89
Command::process_line()
0x45ee65
Command::process_line(UCS_string&, std::ostream*)
0x45f13c
Command::do_APL_command(std::ostream&,
UCS_string&)
0x5d40a1
Workspace::clear_WS(std::ostream&, bool)
0x57f57e
SymbolTable::clear(std::ostream&)
0x57f682
SymbolTable::clear_slot(std::ostream&, int)
0x41c562
Symbol::~Symbol()
0x41c526
Symbol::~Symbol()
0x57ba5e
Symbol::clear_vs()
========================================
========================================
----------------------------------------
-- Stack
trace at Symbol.cc:1310
----------------------------------------
0x7f4e5521030b
__libc_start_main
0x7f4e55210248
0x403dfd
main
0x5d2a8b
Workspace::immediate_execution(bool)
0x45ec89
Command::process_line()
0x45ee65
Command::process_line(UCS_string&, std::ostream*)
0x45f13c
Command::do_APL_command(std::ostream&,
UCS_string&)
0x5d40a1
Workspace::clear_WS(std::ostream&, bool)
0x57f57e
SymbolTable::clear(std::ostream&)
0x57f682
SymbolTable::clear_slot(std::ostream&, int)
0x41c562
Symbol::~Symbol()
0x41c526
Symbol::~Symbol()
0x57ba72
Symbol::clear_vs()
0x7f4e5522978e
0x7f4e552296c1
0x5d931e
Workspace::~Workspace()
0x5d7466
Workspace_0::~Workspace_0()
0x5d73ee
SymbolTable::~SymbolTable()
0x5d7a38
SymbolTableBase<Symbol,
65536ul>::~SymbolTableBase()
0x41c562
Symbol::~Symbol()
0x41c526
Symbol::~Symbol()
0x57ba5e
Symbol::clear_vs()
========================================
========================================
Not quite what I expected when zeroing in into the SYNTAX
ERROR.
<Workspace wsid="Editor" year="2025" month="2"
day="10"
hour="21" minute="42" second="32"
timezone="-21600"
saving_SVN=" 1828" syntax="1.6.1">
Best Regards
Hans-Peter
Am 10.02.25 um 18:55 schrieb
M.Hall:
$ apl
)clear
CLEAR WS
→(0=⍴0)/0
SYNTAX ERROR+
→(0=⍴0)/0
^
)more
branch back into function (→N) without suspended function
Running SVN 1833.
Sorry -
an even shorter way .
)clear
CLEAR WS
→(0=⍴,0)/0
SYNTAX
ERROR+
→(0=⍴0)/0
^
Best Regards
Hans-Peter
Am 10.02.25 um 16:41 schrieb Hans-Peter Sorge:
Hi,
A simple path to reproduce the reported ")Copy bug" :
)clear
CLEAR WS
)copy
Editor
SAVED
2025-02-10 09:15:01 (GMT-6)
E∆Edit
'E∆Edit'
At all
prompts you can type 'end' to exit or backup to
the previous question.
You can often
type 'help' to get help.
Enter your
edit command? edit
Enter the
line numbers you wish to change, or [a,b,r]? 2
SYNTAX
ERROR
E∆Piv[18]
→(0=⍴t)/0
^^
)reset
→(0=⍴,0)/0
SYNTAX
ERROR+
→(0=⍴0)/0
^
The difference!!! <⍴,0>
vs <⍴0>
Best Regards
Hans-Peter
Am 10.02.25 um 15:34 schrieb Blake McBride:
I just checked. None of the problems
I reported were corrected with this change.
Thanks.
Blake
Hi,
latest news: I have corrected an error in the
∇-editor. SVN 1833.
I am currently working on fixing a border case
for function headers.
Not entirely stable yet. Your problem might be
related to specific
function header cases.
Best Regards,
Jürgen
On 2/10/25 13:55, Dr. Jürgen Sauermann
wrote:
Hi,
I am definitely not arguing that the problem
is outside GNU APL. However,
it is very difficult for me to troubleshoot
a problem that only occurs in the context
of a workspace that I am not familiar with.
So please help to simplify the issue
to a smaller size.
Thanks,
Jürgen
On 2/9/25 20:09, Blake McBride wrote:
In case I haven't been
clear, as far as I can tell, all of the
problems are with GNU APL and none are
with the Editor code. At some earlier
date, this exact editor code worked fine
under GNU APL. The editor code hasn't
changed but no longer works; as
reported.
If errors in the editor are found,
I am happy to correct them.
Thanks.
Blake
The help message
should be printed by the first
line of E∆Pim. I checked it and
the code is correct. It just
doesn't run.
If I cut/paste the code into
GNU APL it works fine. But it
doesn't run inside a function.
Just FYI, this Editor WS
was used in a
production environment, on a
daily basis, for years on
other APL systems. When
moving it to GNU APL I had to
type it in so typos are
possible. Other than typos,
however, the code is solid.
Thanks.
Blake
Greetings,
I haven't been using GNU
APL for a while - just
because I had other things I
needed to do. Now, trying
to debug this issue I am
finding several issues.
Here is the first:
)load Editor
SAVED 2025-02-09 10:13:37
(GMT-6)
⎕IO←0
(⎕CR 'E∆Edit')[31;]
EN1:→(2↑bv←qq E∆Pim'Enter
your edit command')/END,EN1
E∆Edit 'E∆Edit'
At all prompts you can type
'end' to exit or backup to
the previous question.
You can often type 'help' to
get help.
Enter your edit command?
help
Enter your edit command?
end
SYNTAX ERROR
E∆Edit[31] →(2↑bv←qq E∆Pim
'Enter your edit
command')/31 34
^^
1. It shouldn't show "31
34". It should show
"END,EN1".
2. Syntax error.
Really? Where?
3. When I typed 'help'
it should have seen a help
message. I haven't traced
this through because of the
syntax error.
This code worked fine
as-is when it was released.
I'll see what I can do
with #3.
Thanks!
Blake
Hello,
I have been
watching this thread.
My impression is that
it is not my code but
a bug in GNU APL. If
it is my code, I am
very happy to fix it.
I will take a look.
Thanks.
Blake
Hi Paul,
maybe Blake has an
idea. For me it is
very difficult to
fix
workspaces that were
contributed by other
users. For the
author of the
workspace fixing
problems is far more
easy.
Best Regards,
Jürgen
On 2/8/25
19:48, Paul
Rockwell wrote:
Unfortunately, I
haven't been able
to get this
reproduced with
anything simpler.
I can reliably
reproduce this
using Blake's APL
Editor found
here: https://github.com/blakemcbride/APLEditor
I don't
believe it to be
an error in the
functions
themselves. I
can )LOAD the
original
workspace and
"fix up"
problematic
functions that I
know have thrown
the syntax error
in the past by
simply opening
and immediately
closing the
funcion (no
other changes)
with the ∇
editor. Things
work fine after
that.
II )SAVE the
workspace, and
then )LOAD the
saved copy, and
the error
re-appears.
I've
validated the
variables in the
offending
statement each
time the error
appears. All
appears normal -
there's no
syntax error
apparent in the
_expression_, so I
have no idea why
the interpreter
is throwing an
error. If the
function/workspace
had problems, to
me it seems as a
result of the
)save,)load,)copy
mechanisms. Only
the ∇ editor
gets me around
the issue - ⎕FX
⎕CR
'function-name'
does not.
Any ideas on
how I can help
track this down?
- Paul
Hi Paul,
that very much
looks like an
error in the
Editor
workspace,
doesn't it?
Can you
reproduce the
fault in plain
APL?
Best Regards,
Jürgen
On 2/6/25
19:14, Paul
Rockwell
wrote:
I've been
seeing syntax
errors being
thrown on
functions
copied from
another
workspace.
I've imported
Blake
McBride's APL
editor from
his GitHub
site (linked
to by the GNU
APL Community
pages). It
seems to be
reasonably up
to date.
Once I
have the
workspace
created
containing the
editor
application, I
)SAVE it. I
then create a
new workspace
and )COPY the
functions in
the editor
workspace into
my current
workspace.
Then I attempt
to use it to
edit a
function (an
alternative to
the ∇ editor).
What I
see is that
the copied
editor
function will
fail with a
syntax error
on branch
statements
within the
function:
)copy Editor
SAVED 2025-01-19
15:03:52
(GMT-5)
E∆Edit 'asd'
At all prompts you
can type 'end'
to exit or
backup to the
previous
question.
You can often type
'help' to get
help.
Enter
the line
numbers you
wish to
change, or
[a,b,r]? 2
SYNTAX ERROR
E∆Piv[18] →(0=⍴t)/0
^^
However, if you look
at the
variables
involved,
there should
be nothing
that should
cause this
syntax error
t
2
⍴t
1
0=⍴t
0
0/0
⍴0/0
0
The
strange thing
about this is
that if I open
the offending
function in
the ∇ editor
and save it
(making no
changes), the
error goes
away... at
least for that
function:
)si
∇E∆Piv
[51] ∇
E∆Edit 'asd'
At all prompts you
can type 'end'
to exit or
backup to the
previous
question.
You can often type
'help' to get
help.
Enter your edit
command? edit
Enter the line
numbers you
wish to
change, or
[a,b,r]? 2
24
Enter your edit
command? end
SYNTAX ERROR
E∆Edit[31] →(2↑bv←qq
E∆Pim 'Enter
your edit
command')/31
34
^^
As you can see,
another
function is
exhibiting the
same error.
Like the E∆Piv
function,
opening the
E∆Edit
function seems
to "fix"the
issue.
What doesn't seem fix
the issue is
using ⎕CR and
⎕FX as an
alternative to
the ∇ editor.
)reset
⎕FX ⎕CR
'E∆Edit'
E∆Edit
E∆Edit 'asd'
At all prompts you
can type 'end'
to exit or
backup to the
previous
question.
You can often type
'help' to get
help.
Enter your edit
command? edit
Enter the line
numbers you
wish to
change, or
[a,b,r]? 2
24
Enter your edit
command? end
SYNTAX ERROR
E∆Edit[31] →(2↑bv←qq
E∆Pim 'Enter
your edit
command')/31
34
^^
As you can see, that
didn't fix the
problem. Now
open E∆Edit
with the ∇
editor and see
what happens:
)reset
∇E∆Edit
[41] ∇
E∆Edit 'asd'
At all prompts you
can type 'end'
to exit or
backup to the
previous
question.
You can often type
'help' to get
help.
Enter your edit
command? edit
Enter the line
numbers you
wish to
change, or
[a,b,r]? 2
24
Enter your edit
command? end
As I
said, this is
very strange
behavior. I
can work
around it, but
quite honestly
it's a pain
because I have
no idea when
the issue is
going to crop
up again.
- Paul
Rockwell
--
Mike Hall
|