[cfe-dev] A trivial test case requires guard variable but it need not

Ahmed Charles ahmedcharles at gmail.com
Mon Feb 13 17:04:55 PST 2012


The feature is thread safe function local static variables. I think
this is mandated by the standard, but perhaps there is a switch to turn
it off?
From: jahanian
Sent: 2/13/2012 3:16 PM
To: cfe-dev at cs.uiuc.edu Developers
Cc: Richard Smith
Subject: [cfe-dev] A trivial test case requires guard variable but it
need not
Hi,

I am not sure which of the recent patches related to recent c++11
initializer work caused this.
In this trivial test case, clang now generates a guard variable. It
need not. This breaks several
of our projects which do not  need (must not have) guard variable.


class IOService;

struct IOSurfaceSendRight { void foo(); };

typedef int (IOService::*IOMethod)();

void a() {
  static IOMethod x = (IOMethod)&IOSurfaceSendRight::foo;
}

% clang -c test.cpp

% nm -nm test.o | grep guard
                 (undefined) external ___cxa_guard_acquire
                 (undefined) external ___cxa_guard_release

% nm -nm test.o | grep guard
                 (undefined) external ___cxa_guard_acquire
                 (undefined) external ___cxa_guard_release
_______________________________________________
cfe-dev mailing list
cfe-dev at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list