title: Segmentation fault (core dumped) when i run my compiled program
body: <p>I have this code :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cmath&gt;
  using namespace std;
  
  class Flacon
  {
  private:
    string nom;
    double volume;
    double pH;
  
  public:
      Flacon(string nom, double volume, double pH): nom(nom), volume(volume), pH(pH) {}
      ostream&amp; etiquette(ostream&amp;) const;
      friend ostream&amp; operator&lt;&lt;(ostream&amp;,const Flacon &amp;);
      friend Flacon&amp; operator+(Flacon const&amp;, Flacon const&amp;);
  
  };
  
  
  Flacon&amp; operator+(Flacon const&amp; f1, Flacon const&amp; f2){
      Flacon f3(f1.nom + " " + f2.nom, f1.volume + f2.volume, -log10((f1.volume * pow(10,-f1.pH) + f2.volume * pow(10,-f2.pH))/(f1.volume + f2.volume)));
      return f3;
  }
  
  ostream&amp; Flacon::etiquette(ostream&amp; sortie) const {
      sortie &lt;&lt; nom &lt;&lt; " : " &lt;&lt; volume &lt;&lt; " ml, pH " &lt;&lt; pH;
      return sortie;}
  
  ostream&amp; operator&lt;&lt;(ostream&amp; o,const Flacon &amp; f){
      f.etiquette(o);
      return o;
  }
  
  /*******************************************
   * Ne rien modifier après cette ligne.
   *******************************************/
  
  void afficher_melange(Flacon const&amp; f1, Flacon const&amp; f2)
  {
    cout &lt;&lt; "Si je mélange " &lt;&lt; endl;
    cout &lt;&lt; "\t\"" &lt;&lt; f1 &lt;&lt; "\"" &lt;&lt; endl;
    cout &lt;&lt; "avec" &lt;&lt; endl;
    cout &lt;&lt; "\t\"" &lt;&lt; f2 &lt;&lt; "\"" &lt;&lt; endl;
    cout &lt;&lt; "j'obtiens :" &lt;&lt; endl;
    cout &lt;&lt; "\t\"" &lt;&lt; (f1 + f2) &lt;&lt; "\"" &lt;&lt; endl;
  }
  
  int main()
  {
    Flacon flacon1("Eau", 600.0, 7.0);
    Flacon flacon2("Acide chlorhydrique", 500.0, 2.0);
    Flacon flacon3("Acide perchlorique",  800.0, 1.5);
  
    afficher_melange(flacon1, flacon2);
    afficher_melange(flacon2, flacon3);
  
    return 0;
  
  }
  </code></pre>
  
  <p>And when I compile,I have this warning message :</p>
  
  <blockquote>
    <p>chimie.cc:23:9: warning: reference to local variable ‘f3’ returned
    [-Wreturn-local-addr]   Flacon f3(f1.nom + " " + f2.nom, f1.volume +
    f2.volume, -log10((f1.volume * pow(10,-f1.pH) + f2.volume *
    pow(10,-f2.pH))/(f1.volume + f2.volume)));</p>
  </blockquote>
  
  <p>And when I build :</p>
  
  <blockquote>
    <p>chimie.cc:23:9: warning: reference to local variable ‘f3’ returned
    [-Wreturn-local-addr] Flacon f3(f1.nom + " " + f2.nom, f1.volume +
    f2.volume, -log10((f1.volume * pow(10,-f1.pH) + f2.volume *
    pow(10,-f2.pH))/(f1.volume + f2.volume)));</p>
  </blockquote>
  
  <p>And when i Run :</p>
  
  <blockquote>
    <p>Si je mélange     "Eau : 600 ml, pH 7" avec   "Acide chlorhydrique : 500
    ml, pH 2" j'obtiens : Segmentation fault (core dumped)</p>
  </blockquote>