diff --git a/DynamicModel.hh b/DynamicModel.hh
index 9cef4cb023a2a1c4ee2ef82131ef33004233f577..9c0e670ff2c0c48d5b3eb51bd573302847da8b48 100644
--- a/DynamicModel.hh
+++ b/DynamicModel.hh
@@ -217,6 +217,9 @@ public:
   //! Writes model initialization and lead/lag incidence matrix to output
   void writeOutput(ostream &output, const string &basename, bool block, bool byte_code, bool use_dll, int order, bool estimation_present, bool compute_xrefs, bool julia) const;
 
+  //! Return true if the hessian is equal to zero
+  inline bool checkHessianZero() const;
+
   //! Adds informations for simulation in a binary file
   void Write_Inf_To_Bin_File_Block(const string &dynamic_basename, const string &bin_basename,
                                    const int &num, int &u_count_int, bool &file_open, bool is_two_boundaries) const;
@@ -492,6 +495,12 @@ public:
   bool isChecksumMatching(const string &basename) const;
 };
 
+inline bool
+DynamicModel::checkHessianZero() const
+{
+  return second_derivatives.empty();
+}
+
 //! Classes to re-order derivatives for various sparse storage formats 
 class derivative
 {
diff --git a/ModFile.cc b/ModFile.cc
index 05c7bce25fd712ebb938de01abe51ba2b92fc496..414a51308b9eb330998240011dbff77f185f1fef 100644
--- a/ModFile.cc
+++ b/ModFile.cc
@@ -519,6 +519,7 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, bool compute_xr
 		  bool hessian = mod_file_struct.order_option >= 2 
 		    || mod_file_struct.identification_present 
 		    || mod_file_struct.estimation_analytic_derivation
+                    || linear
 		    || output == second 
 		    || output == third;
 		  bool thirdDerivatives = mod_file_struct.order_option == 3 
@@ -532,6 +533,12 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, bool compute_xr
 	    }
 	  else // No computing task requested, compute derivatives up to 2nd order by default
 	    dynamic_model.computingPass(true, true, false, none, global_eval_context, no_tmp_terms, block, use_dll, byte_code, compute_xrefs);
+
+      if (linear && !dynamic_model.checkHessianZero())
+        {
+          cerr << "ERROR: If the model is declared linear the second derivatives must be equal to zero." << endl;
+          exit(EXIT_FAILURE);
+        }
     }
 
   for (vector<Statement *>::iterator it = statements.begin();