+dnl PSPP - a program for statistical analysis.
+dnl Copyright (C) 2017 Free Software Foundation, Inc.
+dnl
+dnl This program is free software: you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation, either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
+dnl
+# This checks for regression against a crash reported as bug #38482
+# that occurred when multiple variables were specified without any
+# rank specifications.
+AT_SETUP([RANK multiple variables with defaults])
+AT_DATA([rank.sps], [dnl
+DATA LIST LIST NOTABLE /x * y * z *.
+BEGIN DATA.
+ 1.00 2.00 3.00
+ 4.00 5.00 6.00
+END DATA.
+
+RANK ALL.
+
+LIST.
+])
+AT_CHECK([pspp -o pspp.csv rank.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Variables Created by RANK
+Existing Variable,New Variable,Function
+x,Rx,RANK
+y,Ry,RANK
+z,Rz,RANK
+
+Table: Data List
+x,y,z,Rx,Ry,Rz
+1.00,2.00,3.00,1.000,1.000,1.000
+4.00,5.00,6.00,2.000,2.000,2.000
+])
+AT_CLEANUP
+
-Variables Created By RANK
-
-
-
-a into Ra(RANK of a)
-
-b into Rb(RANK of b)
-
-a into RFR001(RFRACTION of a)
-
-b into RFR002(RFRACTION of b)
-
-a into count(N of a)
-
-b into Nb(N of b)
-
-Variable,Description,,Position
-a,Format: F8.2,,1
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-b,Format: F8.2,,2
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-count,N of a,,3
-,Format: F6.0,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-Ra,RANK of a,,4
-,Format: F9.3,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-Rb,RANK of b,,5
-,Format: F9.3,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-RFR001,RFRACTION of a,,6
-,Format: F6.4,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-RFR002,RFRACTION of b,,7
-,Format: F6.4,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-Nb,N of b,,8
-,Format: F6.0,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
+Table: Variables Created by RANK
+Existing Variable,New Variable,Function
+a,Ra,RANK
+b,Rb,RANK
+a,RFR001,RFRACTION
+b,RFR002,RFRACTION
+a,count,N
+b,Nb,N
+
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format
+a,1,,Scale,Input,8,Right,F8.2,F8.2
+b,2,,Scale,Input,8,Right,F8.2,F8.2
+Ra,3,RANK of a,Scale,Input,8,Right,F9.3,F9.3
+RFR001,4,RFRACTION of a,Scale,Input,8,Right,F6.4,F6.4
+count,5,N of a,Scale,Input,8,Right,F6.0,F6.0
+Rb,6,RANK of b,Scale,Input,8,Right,F9.3,F9.3
+RFR002,7,RFRACTION of b,Scale,Input,8,Right,F6.4,F6.4
+Nb,8,N of b,Scale,Input,8,Right,F6.0,F6.0
-a,b,count,Ra,Rb,RFR001,RFR002,Nb
-.00,24.00,10,10.000,8.000,1.0000,.8889,9
-1.00,32.00,10,9.000,4.000,.9000,.4444,9
-2.00,31.00,10,8.000,5.000,.8000,.5556,9
-2.00,32.00,10,8.000,4.000,.8000,.4444,9
-4.00,30.00,10,6.000,6.000,.6000,.6667,9
-5.00,29.00,10,5.000,7.000,.5000,.7778,9
-6.00,1.00,10,4.000,9.000,.4000,1.0000,9
-7.00,43.00,10,3.000,2.000,.3000,.2222,9
-8.00,. ,10,2.000,. ,.2000,. ,.
-9.00,45.00,10,1.000,1.000,.1000,.1111,9
+a,b,Ra,RFR001,count,Rb,RFR002,Nb
+.00,24.00,10.000,1.0000,10,8.000,.8889,9
+1.00,32.00,9.000,.9000,10,4.000,.4444,9
+2.00,31.00,8.000,.8000,10,5.000,.5556,9
+2.00,32.00,8.000,.8000,10,4.000,.4444,9
+4.00,30.00,6.000,.6000,10,6.000,.6667,9
+5.00,29.00,5.000,.5000,10,7.000,.7778,9
+6.00,1.00,4.000,.4000,10,9.000,1.0000,9
+7.00,43.00,3.000,.3000,10,2.000,.2222,9
+8.00,. ,2.000,.2000,10,. ,. ,.
+9.00,45.00,1.000,.1000,10,1.000,.1111,9
-Variables Created By RANK
-
-
-
-foo into RAN001(RANK of foo)
-
-Variable,Description,,Position
-foo,Format: F8.2,,1
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-rfoo,Format: F8.2,,2
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-ran003,Format: F8.2,,3
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-RAN001,RANK of foo,,4
-,Format: F9.3,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
+Table: Variables Created by RANK
+Existing Variable,New Variable,Function
+foo,RAN001,RANK
+
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format
+foo,1,,Scale,Input,8,Right,F8.2,F8.2
+rfoo,2,,Scale,Input,8,Right,F8.2,F8.2
+ran003,3,,Scale,Input,8,Right,F8.2,F8.2
+RAN001,4,RANK of foo,Scale,Input,8,Right,F9.3,F9.3