Qt Segmentation Fault strtod
<p>Whenever I try to parse a number (i.e. float, double, etc.) from a C string (char *), I get a segmentation fault and its very consistent.</p>

<p>On to the actual code:</p>

<pre><code>//aLocation is a C++ object with two variables double Latitude &amp; double Longitude. 
char** tokens; //Gets used in a string split function.
char* pEnd;
aLocation.setLatitude(strtod(tokens[0],&amp;pEnd));  //tokens[0] = "26.379165"
aLocation.setLongitude(strtod(tokens[1],&amp;pEnd)); //tokens[1] = "-80.101639"
</code></pre>

<p>It should be mentioned that I have tried alternative functions and data types (i.e. atoi, atof, strtol, strtof, &amp; strtol).</p>

<p>I have checked the string split function and it works as expected. I can print the token values fine using "qDebug("Location: %s,%s",tokens[0],tokens<a href="http://pcengines.ch/alix3d3.htm" rel="nofollow">1</a>);". The two strtod() function calls above both seg fault (together or separately). When I remove the above two lines of code from my application, I get no seq faults at all.</p>

<hr>

<p>The run environment is a custom Linux image I made using Buildroot and an older Linux Kernel (3.4.39). The application is written in C++ using the Qt 4.8.4 SDK. The device I am running the application on is the <a href="http://pcengines.ch/alix3d3.htm" rel="nofollow">alix3d</a> motherboard, with some custom IC additions (over USB). I am also using the ld-uClibc.so.0 library.</p>

<p><strong>Location.h:</strong></p>

<pre><code>#ifndef LOCATION_H
#define LOCATION_H

class Location
{
public:
    explicit Location();
    void setLatitude(double aLat);
    double getLatitude();
    void setLongitude(double aLong);
    double getLongitude();


private:
    double latitude;
    double longitude;

};

#endif // LOCATION_H
</code></pre>

<p><strong>Location.cpp:</strong></p>

<pre><code>#include "location.h"

Location::Location()
{
}

void Location::setLatitude(double aLat){latitude=aLat;}

double Location::getLatitude(){return latitude;}

void Location::setLongitude(double aLong){longitude = aLong;}

double Location::getLongitude(){return longitude;}
</code></pre>

<p><strong>UPDATE</strong></p>

<pre><code>Case 1: this-&gt;aLocation.setLatitude(1); ------&gt; works (No additional code above or below)

Case 2:double aLat = (double)strtod(tokens[0], &amp;pEnd); ---&gt; works (No additional code below this)

Case 3: Below Code Seg faults 
double aLat = (double)strtod(tokens[0], &amp;pEnd);
this-&gt;rsuLocation.setLatitude(aLat);
</code></pre>