Source: apertium
Severity: minor
Tags: patch
User: [email protected]
Usertags: clang-ftbfs

Dear Maintainer,

Your package fails to build with clang instead of gcc.
Log file available here: 
http://clang.debian.net/logs/2014-01-14/apertium_3.1.0-2_unstable_clang.log

The attached patch fixes it.

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.13-1-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
--- apertium-3.1.0/apertium/hmm.cc	2008-11-25 10:39:55.000000000 -0500
+++ apertium-3.1.0-my/apertium/hmm.cc	2014-05-22 14:50:59.956906339 -0400
@@ -727,7 +727,7 @@
   double prob, loli, x;
   int N = td->getN();  
   double alpha[2][N];
-  vector<TTag> best[2][N];
+  vector<TTag> **best = reinterpret_cast<vector<TTag> **>(alloca(sizeof(vector<TTag>) * 2 * N));
   
   vector <TaggerWord> wpend; 
   int nwpend;
--- apertium-3.1.0/apertium/lextor.cc	2008-12-08 13:23:01.000000000 -0500
+++ apertium-3.1.0-my/apertium/lextor.cc	2014-05-22 14:50:59.940906339 -0400
@@ -277,8 +277,8 @@
 	    //Note: Words in the context can also be ambiguous (with more than one lexical choice)
 	    //In that case the count will come from all the possible
 	    //translations 
-	    vector<wstring> translation_buffer[buffer_max_size];
-	    wstring reduced_buffer[buffer_max_size];
+	    vector<wstring> *translation_buffer = reinterpret_cast<vector<wstring> *>(alloca(sizeof(vector<wstring>) * buffer_max_size));
+	    wstring *reduced_buffer = reinterpret_cast<wstring *>(alloca(sizeof(wstring) * buffer_max_size));
 
 	    for (int i=0; i<(int)buffer_max_size; i++) {
 	      reduced_buffer[i]=lextor_data->reduce(buffer[i].get_word_string());	      
@@ -867,8 +867,8 @@
   }  
 
   double lexchoices_count[window[word_index].n_lexical_choices()];
-  vector<wstring> translation_window[window.size()];
-  wstring reduced_window[window.size()];
+  vector<wstring> *translation_window = reinterpret_cast<vector<wstring> *>(alloca(sizeof(vector<wstring>) * window.size()));
+  wstring *reduced_window = reinterpret_cast<wstring *>(alloca(sizeof(wstring) * window.size()));
 
   for (unsigned i=0; i<window.size(); i++) 
     reduced_window[i]=lextor_data->reduce(window[i].get_word_string());	      

Reply via email to