public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/10415] New: Compiler error when compiling test-tgmath2.c with  gcc 4.5.0 (20090717) + fix
@ 2009-07-19 18:39 dps at simpson dot demon dot co dot uk
  2009-09-26 17:58 ` [Bug math/10415] " schwab at linux-m68k dot org
  2009-09-27 16:39 ` schwab at linux-m68k dot org
  0 siblings, 2 replies; 3+ messages in thread
From: dps at simpson dot demon dot co dot uk @ 2009-07-19 18:39 UTC (permalink / raw)
  To: glibc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2721 bytes --]

This bug also affects the i686-pc-linux-gnu target and probably most other
targets In make check gcc 4.5.0 says:

test-tgmath2.c: In function ‘test’:
test-tgmath2.c:167:3: error: assignment of read-only variable ‘texpr’
test-tgmath2.c:168:3: error: assignment of read-only variable ‘texpr’
test-tgmath2.c:169:3: error: assignment of read-only variable ‘texpr’
test-tgmath2.c:178:3: error: assignment of read-only variable ‘texpr’
test-tgmath2.c:179:3: error: assignment of read-only variable ‘texpr’

My diagnosis that __typeof__ (expr) texpr declares texpr to be const in those
tests, so the assignment further down in the TEST2 macro produces an error message.

The following patch uses mixed declarations and code to eliminate the
assignment, which fixes the problem. It might be nice if the compiler supported
declaring a variable as const and allowing a single assignment to it sometime later.

--- math/test-tgmath2.c.dist    2009-07-19 17:22:48.664507445 +0100
+++ math/test-tgmath2.c 2009-07-19 19:24:45.952008134 +0100
@@ -120,13 +120,12 @@
 #define TEST2(expr, type, rettype, fn) \
   do                                                           \
     {                                                          \
-      __typeof__ (expr) texpr = 0;                             \
       TEST_TYPE_ONLY (expr, rettype);                          \
       if (count != 0)                                          \
        FAIL ("internal error");                                \
       if (counts[T##type][C_##fn] != 0)                                \
        FAIL ("internal error");                                \
-      texpr = expr;                                            \
+      __typeof__ (expr) texpr = expr;                          \
       __asm __volatile ("" : : "r" (&texpr));                  \
       if (count != 1 || counts[T##type][C_##fn] != 1)          \
        {                                                       \

-- 
           Summary: Compiler error when compiling test-tgmath2.c with  gcc
                    4.5.0 (20090717) + fix
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: dps at simpson dot demon dot co dot uk
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=10415

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug math/10415] Compiler error when compiling test-tgmath2.c with  gcc 4.5.0 (20090717) + fix
  2009-07-19 18:39 [Bug math/10415] New: Compiler error when compiling test-tgmath2.c with gcc 4.5.0 (20090717) + fix dps at simpson dot demon dot co dot uk
@ 2009-09-26 17:58 ` schwab at linux-m68k dot org
  2009-09-27 16:39 ` schwab at linux-m68k dot org
  1 sibling, 0 replies; 3+ messages in thread
From: schwab at linux-m68k dot org @ 2009-09-26 17:58 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From schwab at linux-m68k dot org  2009-09-26 17:58 -------
It's a compiler bug (http://gcc.gnu.org/PR41476).

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10415

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug math/10415] Compiler error when compiling test-tgmath2.c with  gcc 4.5.0 (20090717) + fix
  2009-07-19 18:39 [Bug math/10415] New: Compiler error when compiling test-tgmath2.c with gcc 4.5.0 (20090717) + fix dps at simpson dot demon dot co dot uk
  2009-09-26 17:58 ` [Bug math/10415] " schwab at linux-m68k dot org
@ 2009-09-27 16:39 ` schwab at linux-m68k dot org
  1 sibling, 0 replies; 3+ messages in thread
From: schwab at linux-m68k dot org @ 2009-09-27 16:39 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From schwab at linux-m68k dot org  2009-09-27 16:39 -------
Fixed in the compiler.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=10415

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-27 16:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-19 18:39 [Bug math/10415] New: Compiler error when compiling test-tgmath2.c with gcc 4.5.0 (20090717) + fix dps at simpson dot demon dot co dot uk
2009-09-26 17:58 ` [Bug math/10415] " schwab at linux-m68k dot org
2009-09-27 16:39 ` schwab at linux-m68k dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).