Skip to content

[Regression] Formatted read into structure is broken. #1970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jtappin opened this issue Jan 22, 2025 · 0 comments
Closed

[Regression] Formatted read into structure is broken. #1970

jtappin opened this issue Jan 22, 2025 · 0 comments
Labels
regression Something that used to work does not work anymore

Comments

@jtappin
Copy link

jtappin commented Jan 22, 2025

We have a regression for formatted read of a structure. Somewhere between commits 27b7038 and 35d32bb for following code begins to fail.

Code (tsr.pro):

pro tsr, file

  rcd = {index: 0l, $
         catalogue: 0l, $
         date: 0.d}

  nrecs = file_lines(file)

  rcc = replicate(rcd, nrecs)
  
  openr, ilu, /get, file
  for j = 0, nrecs-1 do begin
     readf, ilu, rcd
     
     rcc[j] = rcd

  endfor

  free_lun, ilu
end

Data (indat.dat):

5 140 454.9867
9 145 97843.973284
16 144 768.555

Result:

GDL> tsr, 'indat.dat'
% TSR: End of file encountered. Internal error: Stream not found.
% Execution halted at: TSR                 13 /scratch/james/tsr.pro
%                      $MAIN$          
GDL> help, rcd
** Structure <Anonymous>, 3 tags,memsize =16, data length=16/16:
   INDEX           LONG                 5
   CATALOGUE       LONG                 0
   DATE            DOUBLE           0.0000000
GDL> 

Note that the first field of the structure is filled, the rest are not.

@GillesDuvert GillesDuvert added the regression Something that used to work does not work anymore label Jan 24, 2025
GillesDuvert pushed a commit to GillesDuvert/gdl that referenced this issue Jan 30, 2025
GillesDuvert pushed a commit to GillesDuvert/gdl that referenced this issue Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Something that used to work does not work anymore
Projects
None yet
Development

No branches or pull requests

2 participants