Fortran · 592 bytes Raw Blame History
1 ! audit31 Finding 3: character variable/parameter initializer used
2 ! to be silently dropped. init_decls had a catch-all `continue` for
3 ! any char_kind != None, so `character(len=5) :: a = 'hello'` left
4 ! the stack buffer zero-initialised. Added a Fixed-len path that
5 ! calls afs_assign_char_fixed to copy the literal with
6 ! space-padding to the declared length. Task #484.
7 ! CHECK: hello
8 ! CHECK: world
9 program audit31_char_init
10 implicit none
11 character(len=5) :: a = 'hello'
12 character(len=5), parameter :: b = 'world'
13 print *, '[', a, ']'
14 print *, '[', b, ']'
15 end program
16