Skip to content
Tcl Source Code View Ticket
Login

View Ticket

No such variable error on HP-UX 11, native cc with 64-bit

Closed968422ffffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-06-07 20:19:25
Compiling CVS Head (which I think corresponds to 8.5a1)
on HP-UX 11.0 using this configuration:

  ./configure CC=cc CFLAGS=+Onolimit --enable-64bit

produces a tclsh that doesn't work correctly.  When
attempting any package require, this error is reported.

  % package require tcltest
  can't read "old": no such variable
  % set ::errorInfo
  can't read "old": no such variable
      while executing
  "if {$dir ne $old} {
                      # This entry in $::auto_path has
changed.
                      break
                  }"
      (procedure "tclPkgUnknown" line 60)
      invoked from within
  "tclPkgUnknown tcltest {}"
      ("package unknown" script)
      invoked from within
  "package require tcltest"


The "reduced" code to generate this error is a
double-foreach loop in a proc, like this:

  % proc a {} {foreach a {1 2 3} b {4 5 6} {puts "$a $b"}}
  % a
  can't read "b": no such variable



This error only occurs with both "+DD64" from the
--enable-64bit configure option and the "+Onolimit"
option, which HP documents as "Do not suppress
optimizations that significantly increase compile-time
or consume enormous amounts of memory."  

I'm not sure which optimizations are usually suppressed
- the documentation only mentions +Oinline_budget,
which does not seem to be the root of this problem.  So
I haven't narrowed it down to a specific optimization.

So it might be an HP optimizer problem, or it might be
a Tcl code problem.  I will check our compiler revision
to find out if there are HP patches.
dgpplain2004-06-08 05:09:27
Logged In: YES 
user_id=80530

Sounds like an optimization bug
in the compiler.  Shows up in
compiled [foreach] commands,
so I'd check what the compiler
is doing with TclCompileForeachCmd().

One simple thing to check is
to build a TCL_COMPILE_DEBUG
tclsh, and use tcl_traceCompile to
check whether the correct bytecode
is being generated.

See Bug 617689 for inspiration on
how to proceed, or to be convinced
that, yes, sometimes it can be the
compiler's fault.  :^)
techentinplain2004-07-15 02:32:27
Logged In: YES 
user_id=43494

Our sysadmin upgraded the native HP compiler to 11.11.10, 
and I still get the same failure with Tcl compiled with the 
optimzer.  I guess the answer is "Don't do that."
hobbsplain2004-07-15 02:38:42
Logged In: YES 
user_id=72656

Upgrading the compiler doesn't necessarily mean that this
particular bug was addressed.  As this works just fine for
me on a similar machine (and for the poster) at a different
O level, I'm closing this out as a compiler issue (rare, but
not unique).
msoferplain2004-07-15 02:39:44
Logged In: YES 
user_id=148712

Comment on don's comment: I would a priori rather suspect a
problem in compiling the INST_FOREACH instructions in the
bytecode engine (TEBC) rather than in the bytecode compiler.
Does the problem appear also in tcl8.4, or is it new to 8.5?
techentin Closed ticket [968422ffff]. [History diff]2004-07-27 00:35:23
Log in (anonymous is fine) to add a comment.