🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #10089

Problemilla con gcc-3.0

#10089
From: gypse
Date: Sat, 23 Mar 2002 08:53
30 lines
1646 bytes
Hola a todos.

Me sucede una cosa estra�a con el gcc 3.0.4. Explico.

Supongamos estas macros:

#define SWAP(a,b,to_int)\
{\
  to_int(a) ^= to_int(b);\
  to_int(b) ^= to_int(a);\
  to_int(a) ^= to_int(b);\
}

#define INTf(f) = (*(int*)&(f))
#define INTd(d) = (*(long long*)&(d))

#define SWAPf(a,b) = SWAP(a,b,INTf)
#define SWAPd(a,b) = SWAP(a,b,INTd)

que solo sirven para intercambiar dos variables sin una tercera, SWAPf
para floats y SWAPd para doubles.

Pues bien, con el gcc 2.95 funcionan correctamente con cualquier nivel de
optimizaci�n, pero con el gcc-3.0 a partir de -O2 petan maravillosamente,
en el caso de SWAPf no intercambia nada y en el de SWAPd da un resultado
absurdo. 

alguna idea? 

Venga, un saludo.
Technical Details
Message-ID: <pan.2002.03.23.09.53.27.937121.18941@gmx.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!opentransit.net!fu-berlin.de!uni-berlin.de!191-vale-x32.libre.retevision.ES!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,341e083a706feca9,start
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-03-23 00:49:41 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!opentransit.net!fu-berlin.de!uni-berlin.de!191-vale-x32.libre.retevision.ES!not-for-mail
From: gypse <gypse@gmx.net>
Newsgroups: es.comp.os.linux.programacion
Subject: Problemilla con gcc-3.0
Date: Sat, 23 Mar 2002 09:53:29 +0100
Lines: 30
Message-ID: <pan.2002.03.23.09.53.27.937121.18941@gmx.net>
NNTP-Posting-Host: 191-vale-x32.libre.retevision.es (62.82.77.191)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: fu-berlin.de 1016873379 22450624 62.82.77.191 (16 [103708])
X-Orig-Path: not-for-mail
User-Agent: Pan/0.11.2 (Unix)
X-Comment-To: ALL