[Gambas-bugtracker] Bug #1628: No overflow !?

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Mon Jul 22 22:57:42 CEST 2019


http://gambaswiki.org/bugtracker/edit?object=BUG.1628&from=L21haW4-

juan JUAN reported a new bug.

Summary
-------

No overflow !?

Type             : Bug
Priority         : Low
Gambas version   : Master
Product          : Language


Description
-----------

Goodnight.
Apparently the overflow with Long variables is not well managed:

Public Sub Main()

  Dim a As Long
  Dim b As Long
  Dim c As Long

  a = &H7FFFFFFFFFFFFFFF '2^63 - 1 = 9223372036854775807
  b = 1
  c = a + b
  Print c

  c = a - b
  Print c

  a = 2 ^ 62
  b = 2
  c = a * b
  Print c

End

Output:
-9223372036854775808
9223372036854775806
-9223372036854775808
In the first and third case it should be overflow.


System information
------------------

[System]
Gambas=3.13
OperatingSystem=Linux
Kernel=4.19.0-5-amd64
Architecture=x86_64
Distribution=debian 10.0
Desktop=KDE5
Theme=Oxygen
Language=es_ES.UTF-8
Memory=1993M

[Libraries]
Cairo=libcairo.so.2.11600.0
Curl=libcurl.so.4.5.0
DBus=libdbus-1.so.3.19.11
GStreamer=libgstreamer-1.0.so.0.1404.0
GTK+2=libgtk-x11-2.0.so.0.2400.32
GTK+3=libgtk-3.so.0.2404.1
OpenGL=libGL.so.1.7.0
Poppler=libpoppler.so.82.0.0
QT4=libQtCore.so.4.8.7
QT5=libQt5Core.so.5.11.3
SDL=libSDL-1.2.so.0.11.4
SQLite=libsqlite3.so.0.8.6

[Environment]
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DESKTOP_SESSION=/usr/share/xsessions/plasma
DISPLAY=:0
GB_GUI=gb.qt5
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
GS_LIB=<home>/.fonts
GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:<home>/.gtkrc-2.0:<home>/.config/gtkrc-2.0
GTK_RC_FILES=/etc/gtk/gtkrc:<home>/.gtkrc:<home>/.config/gtkrc
HOME=<home>
KDE_FULL_SESSION=true
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=5
LANG=es_ES.UTF-8
LANGUAGE=es_ES.UTF-8
LOGNAME=<user>
MATHEMATICA_HOME=/usr/local/Wolfram/Mathematica/10.0
PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
PWD=<home>
QT_ACCESSIBILITY=1
QT_AUTO_SCREEN_SCALE_FACTOR=0
SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/1258,unix/<hostname>:/tmp/.ICE-unix/1258
SHELL=/bin/bash
SHLVL=0
SSH_AGENT_PID=1193
SSH_AUTH_SOCK=/tmp/ssh-wCApqhyT3nCR/agent.1161
TZ=:/etc/localtime
USER=<user>
XAUTHORITY=/tmp/xauth-1000-_0
XCURSOR_SIZE=0
XCURSOR_THEME=Adwaita
XDG_CURRENT_DESKTOP=KDE
XDG_DATA_DIRS=/usr/share:/usr/share:/usr/local/share
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=3
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_SESSION_TYPE=x11
XDG_VTNR=7




More information about the Bugtracker mailing list