GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » Fairroot » General Discussion » pointer handling in base/source/swaplw.c can fail on 64 bit systems
pointer handling in base/source/swaplw.c can fail on 64 bit systems [message #17814] Wed, 28 January 2015 19:15 Go to previous message
Volker Friese is currently offline  Volker Friese
Messages: 361
Registered: April 2004
Location: GSI CBM
first-grade participant
From: *dip0.t-ipconnect.de
Bug report of W. Müller, forwarded from the CbmRoot redmine:


The 1995 vintage code in base/source/swaplw.c uses the construct

switch ( (int) p_dest)
 {
      case 0:           /* source == destination /
     ...
     default:           / source != destination */
     ....
   }


The pointer to int cases causes a

warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]


warning in gcc. This construct will fail when p_dest is exactly
on a 4 GB border, in that case p_dest is != 0 but the cast int
will be zero (taking the lower 32 bit only). Unlikely, but possible.

This should be rephrased as

if (p_dest) {
     ....
  } else {
     ....
  }

 
Read Message
Read Message
Previous Topic: Certificate of FairRoot Redmine
Next Topic: Problem on running FairRoot tutorial macro
Goto Forum:
  


Current Time: Sun Feb 24 04:00:26 CET 2019

Total time taken to generate the page: 0.02006 seconds