Description: <Fixes overly aggressive compiler optimization by gcc 4.7 leading to assert fail when called by wvdial>

This patch was originally commited to Fedora by its author Michal Sekletar <msekleta <at> redhat.com>.
The magic_number variable is used within code which provides a sentinel
for testing stack smashing. Setting magic_number to volatile prevents
gcc 4.7 from optimizing away this code incorrectly.
Origin: <other>, <http://permalink.gmane.org/gmane.linux.redhat.fedora.extras.cvs/779635>
Bug: upstream is dead
Bug-Debian: http://bugs.debian.org/674006
Bug-Ubuntu: https://launchpad.net/bugs/1004262
Forwarded: <not-needed>
Reviewed-By: <drysdalepete@gmail.com>
Last-Update: <2012-06-08>

--- wvstreams-4.6.1.orig/include/wvtask.h
+++ wvstreams-4.6.1/include/wvtask.h
@@ -45,7 +45,8 @@ class WvTask
     typedef void TaskFunc(void *userdata);
     
     static int taskcount, numtasks, numrunning;
-    int magic_number, *stack_magic;
+    int volatile magic_number;
+    int *stack_magic;
     WvString name;
     int tid;
     
@@ -84,7 +85,7 @@ class WvTaskMan
     static WvTaskMan *singleton;
     static int links;
     
-    static int magic_number;
+    static int volatile magic_number;
     static WvTaskList all_tasks, free_tasks;
     
     static void get_stack(WvTask &task, size_t size);
--- wvstreams-4.6.1.orig/utils/wvtask.cc
+++ wvstreams-4.6.1/utils/wvtask.cc
@@ -58,7 +58,8 @@ char *alloca ();
 int WvTask::taskcount, WvTask::numtasks, WvTask::numrunning;
 
 WvTaskMan *WvTaskMan::singleton;
-int WvTaskMan::links, WvTaskMan::magic_number;
+int WvTaskMan::links;
+int volatile WvTaskMan::magic_number;
 WvTaskList WvTaskMan::all_tasks, WvTaskMan::free_tasks;
 ucontext_t WvTaskMan::stackmaster_task, WvTaskMan::get_stack_return,
     WvTaskMan::toplevel;
