avr-libc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-commit] [2399] GCC 4.5+ implies malloc() and free() have no si


From: Joerg Wunsch
Subject: [avr-libc-commit] [2399] GCC 4.5+ implies malloc() and free() have no side-effects to global
Date: Mon, 13 May 2013 15:12:10 +0000

Revision: 2399
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2399
Author:   joerg_wunsch
Date:     2013-05-13 15:12:10 +0000 (Mon, 13 May 2013)
Log Message:
-----------
GCC 4.5+ implies malloc() and free() have no side-effects to global
variables.  Place a memory barrier before any evaluations of __flp or
__brkval to ensure the compiler actually reads them from the
respective memory locations.

Modified Paths:
--------------
    trunk/avr-libc/ChangeLog
    trunk/avr-libc/tests/simulate/regression/bug-28135.c

Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog    2013-05-08 11:45:54 UTC (rev 2398)
+++ trunk/avr-libc/ChangeLog    2013-05-13 15:12:10 UTC (rev 2399)
@@ -1,3 +1,11 @@
+2013-05-13  Joerg Wunsch <address@hidden>
+
+       * tests/simulate/regression/bug-28135.c: GCC 4.5+ implies malloc()
+       and free() have no side-effects to global variables.  Place a
+       memory barrier before any evaluations of __flp or __brkval to
+       ensure the compiler actually reads them from the respective memory
+       locations.
+
 2013-05-08  Joerg Wunsch <address@hidden>
 
        Submitted by Frédéric Nadeau:

Modified: trunk/avr-libc/tests/simulate/regression/bug-28135.c
===================================================================
--- trunk/avr-libc/tests/simulate/regression/bug-28135.c        2013-05-08 
11:45:54 UTC (rev 2398)
+++ trunk/avr-libc/tests/simulate/regression/bug-28135.c        2013-05-13 
15:12:10 UTC (rev 2399)
@@ -32,6 +32,7 @@
 /* $Id$ */
 
 #include <stdlib.h>
+#include <avr/cpufunc.h>
 
 #include "../../libc/stdlib/stdlib_private.h"
 
@@ -52,6 +53,7 @@
        if (p != p1)
                return 2;
 
+       _MemoryBarrier();
        if (__flp)
                return 3;
 
@@ -60,6 +62,7 @@
        if (!p)
                return 4;
 
+       _MemoryBarrier();
        /* should be empty */
        if (__flp)
                return 5;
@@ -90,6 +93,7 @@
        if (!p)
                return 10;
 
+       _MemoryBarrier();
        if (!__flp)
                return 11;
 
@@ -97,6 +101,7 @@
        if (p1 != p)
                return 12;
 
+       _MemoryBarrier();
        if (!__flp)
                return 13;
 
@@ -107,6 +112,7 @@
        if (!p)
                return 15;
 
+       _MemoryBarrier();
        if (!__flp)
                return 16;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]