Sender: ghh AT mail DOT mtk DOT nao DOT ac DOT jp Message-ID: <38BB8670.F2216926@nao.ac.jp> Date: Tue, 29 Feb 2000 17:42:24 +0900 From: Gerhard Heinzel Organization: National Astronomical Observatory, Mitaka, Tokyo, Japan X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: de, en, ja, zh-CN MIME-Version: 1.0 To: pgcc AT delorie DOT com Subject: inline optimizer bug Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Reply-To: pgcc AT delorie DOT com I had forgotten to mark the line I believe to be wrong... I use pgcc-2.95.2 19991024 (release) The attached code is compiled wrongly with -O3 I believe the problem is in the line marked with asterisks, but I do not understand enough assembler to look into it myself. RIGHT: ghh AT ghhpc:/home/ghh > gcc -o err0 err.c ghh AT ghhpc:/home/ghh > err0 3.71849 5.57773 4.71849 5.57773 -6.77209 16.253 -2.05361 21.8307 2.32759 3.49138 -2.05361 21.8307 WRONG: ghh AT ghhpc:/home/ghh > gcc -Wall -O3 -o err1 err.c ghh AT ghhpc:/home/ghh > err1 3.71849 5.57773 4.71849 5.57773 3.16767 6.98277 7.88616 12.5605 2.32759 3.49138 7.88616 12.5605 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Gerhard Heinzel e-mail: gerhard DOT heinzel AT nao DOT ac DOT jp Space-Time Astronomy Section, National Astronomical Observatory, 2-21-1 Ohsawa, Mitaka, Tokyo 181-8588, Japan, FAX: 81+422-34-3793, Tel. 81+422-34-3618 http://tamago.mtk.nao.ac.jp/ http://users.cybercity.dk/~cis6614/Lucia -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- #include struct complex_t { double re, im; }; typedef struct complex_t mycomplex; static inline mycomplex zadd (mycomplex z1, mycomplex z2) { mycomplex z; z.re = z1.re + z2.re; z.im = z1.im + z2.im; return z; } static inline mycomplex zmlt (mycomplex z1, mycomplex z2) { mycomplex z; z.re = z1.re * z2.re - z1.im * z2.im; z.im = z1.re * z2.im + z1.im * z2.re; return z; } int main (void) { double polef = 0.429629; double poleq = 0.625951; mycomplex x, x1, s, y, z1, z2; s.re = 1; s.im = 1.5; x.re = 1.; x.im = 0.; x1.re = 1.; x1.im = 0.; y = s; y.re /= (polef * poleq); y.im /= (polef * poleq); z1 = zadd (x1, y); x1 = z1; printf (" %g %g %g %g\n", y.re, y.im, x1.re, x1.im); y = s; y.re /= (polef); y.im /= (polef); z1 = zmlt (y, y); /******************************************/ z2 = zadd (x1, z1); x1 = z2; printf (" %g %g %g %g %g %g %g %g\n", z1.re, z1.im, z2.re, z2.im, y.re, y.im, x1.re, x1.im); return 0; }