Tcl Source Code

View Ticket
Login
Ticket UUID: 1551762
Title: 64 bit integer math on Cygwin broken
Type: Bug Version: obsolete: 8.5a5
Submitter: nobody Created on: 2006-09-04 05:17:19
Subsystem: 52. Portability Support Assigned To: dkf
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2007-02-02 10:20:03
Resolution: Postponed Closed By: sf-robot
    Closed on: 2007-02-02 03:20:03
Description:
Cygwin Tcl 8.5a5:

 $ uname
 CYGWIN_NT-5.0
 $ tclsh.exe
 % puts $tcl_version
 8.5
 % expr 1234567890123*100000
 -1506787104

After patch:

 tcl/unix$ ./tclsh.exe
 % puts $tcl_version
 8.5
 % expr 1234567890123*100000
 123456789012300000

[email protected]
User Comments: sf-robot added on 2007-02-02 10:20:03:
Logged In: YES 
user_id=1312539
Originator: NO

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

dkf added on 2007-01-18 16:10:26:
Logged In: YES 
user_id=79902
Originator: NO

The suggested patch is in error anyway. The correct fix *must* be applied to tcl.m4 (look at the SC_TCL_64BIT_FLAGS macro; when run under Cygwin, it must arrange for TCL_WIDE_INT_TYPE to be defined to "long long"). The hacking in tcl.h is *only* for platforms that *cannot* support the running of configure; cygwin is clearly not such a system.

Failing that, report the exact contents of config.log from these Cygwin systems so that I can figure out why the existing code is failing to detect that "long long" is legal.

nobody added on 2007-01-18 08:50:34:
Logged In: NO 

Cygwin 64 bit math is broken in the latest Tcl source tree, as seen in the example above. The supplied patch fixes that problem. Please apply it. It certainly won't make Cygwin 64-bit math "more broken" than it already is.

nobody added on 2006-09-11 08:11:39:
Logged In: NO 

Can someone please commit this patch as obvious?

+#      elif defined(__CYGWIN__)
+#         define TCL_LL_MODIFIER"ll"
+#         define TCL_LL_MODIFIER_SIZE2

Cygwin uses GCC and GNU libc, and long long is %lld, not %L.
This is why it is broken.

dkf added on 2006-09-10 17:25:43:
Logged In: YES 
user_id=79902

If Cygwin is built using the unix configure, at least one of
TCL_WIDE_INT_TYPE and TCL_WIDE_INT_IS_LONG should be defined
and the existing unix path through tcl.h's nest of #ifdefs
should be taken. If Cygwin is failing to do this, it is a
failure of the configure script and tcl.m4 should be updated
to fix.

If you're going to use the unix machinery to configure, you
should do so *properly*!

nobody added on 2006-09-10 05:27:26:
Logged In: NO 

tcl/win/configure is definitely not suitable for Cygwin Tcl;
it produces a large number of failed tests. *Many* problems
arise in Cygwin programs when Windows-isms are mixed with
UNIX. A tcl/unix/configure build produces the best test
results for Cygwin. When you go behind Cygwin's
UNIX-emulation layer's back and modify Windows resources
directly all manner of undefined things happen. If people
want a pure-Windows Tcl, they should use MinGW instead.

The only other change I would recommend for Cygwin is this:


--- tcl/unix/tclUnixInit.c-orig 2006-09-09
18:23:32.000000000 -0400
+++ tcl/unix/tclUnixInit.c      2006-09-09
18:23:52.000000000 -0400
@@ -837,6 +837,8 @@
 
 #ifdef DJGPP
     Tcl_SetVar2(interp, "tcl_platform", "platform", "dos",
TCL_GLOBAL_ONLY);
+#elif defined(__CYGWIN__)
+    Tcl_SetVar2(interp, "tcl_platform", "platform",
"windows", TCL_GLOBAL_ONLY);
 #else
     Tcl_SetVar2(interp, "tcl_platform", "platform", "unix",
TCL_GLOBAL_ONLY);
 #endif


As it makes the SQLite regression test suite work correctly.

dgp added on 2006-09-05 03:27:45:
Logged In: YES 
user_id=80530


The underlying issue in the
patch is platform support
for the Tcl_WideInt type.
Passing to someone better
suited to examine that.

Would also be useful for
someone to weigh in whether
the tcl/unix/configure is
the right one for Cygwin.
tcl/win/configure may be
more appropriate.

nobody added on 2006-09-04 23:03:29:
Logged In: NO 

tcl/unix/configure was used.

nobody added on 2006-09-04 12:17:19:

File Added - 191898: cygwin-tcl-8_5a5.patch.txt

Attachments: