epiqc / ScaffCC

Compilation, analysis and optimization framework for the Scaffold quantum programming language.
BSD 2-Clause "Simplified" License
192 stars 53 forks source link

Segmentation fault when generating QASM when file contains `cbit c = MeasZ(q);` #29

Open vadym-kl opened 6 years ago

vadym-kl commented 6 years ago

Running scaffold.sh -f for the following file:

int main() {
    qbit q[1];
    cbit c = MeasZ(q[0]);
    return 0;
}

causes Segmentation fault :

measure_qubit.scaffold                                                                                                                                                                                                                
[Scaffold.makefile] Compiling measure_qubit_merged.scaffold ...                                                                                                                                                                       
[Scaffold.makefile] Transforming cbits ...                                                                                                                                                                                            
[Scaffold.makefile] O1 optimizations ...                                                                                                                                                                                              
[Scaffold.makefile] Unrolling Loops (1) ...                                                                                                                                                                                           
[Scaffold.makefile] Cloning Functions (1) ...                                                                                                                                                                                         
Functions Cloned: 0                                                                                                                                                                                                                   
[Scaffold.makefile] Dead Argument Elimination (1) ...                                                                                                                                                                                 
[Scaffold.makefile] Unrolling Loops (2) ...                                                                                                                                                                                           
[Scaffold.makefile] Cloning Functions (2) ...                                                                                                                                                                                         
Functions Cloned: 0                                                                                                                                                                                                                   
[Scaffold.makefile] Dead Argument Elimination (2) ...                                                                                                                                                                                 
[Scaffold.makefile] Internalizing and Removing Unused Functions ...                                                                                                                                                                   
[Scaffold.makefile] Inserting Reverse Functions...                                                                                                                                                                                    
[Scaffold.makefile] Flattening modules ...                                                                                                                                                                                            
/bin/bash: line 1:    76 Segmentation fault      /root/ScaffCC/build/Release+Asserts/bin/opt -load /root/ScaffCC/build/Release+Asserts/lib/Scaffold.so -gen-qasm measure_qubit12.inlined.ll 2> measure_qubit.qasmh > /dev/null        

Running scaffold.sh does not cause any problems. Above is a problem when running on epiqc/scaffcc Docker.