llvm-project/flang/test/Lower/global-format-strings.f90
David Truby 8cb0c3bb21 [flang] Add COMDAT to global variables where needed
On platforms which support COMDAT sections we should use them when
linkonce or linkonce_odr linkage is requested. This is required on
Windows (PE/COFF) and provides better behaviour than weak symbols on
ELF-based platforms.

This patch also reverts string literals to use linkonce instead of
internal linkage now that comdats are supported.

Differential Revision: https://reviews.llvm.org/D153768
2023-06-28 13:49:30 +01:00

15 lines
465 B
Fortran

! RUN: bbc -emit-fir -o - %s | FileCheck %s
! Test checks whether the text of the format statement is hashconed into a
! global similar to a CHARACTER literal and then referenced.
program other
write(10, 1008)
! CHECK: fir.address_of(@{{.*}}) :
1008 format('ok')
end
! CHECK-LABEL: fir.global linkonce @_QQcl.28276F6B2729 constant
! CHECK: %[[lit:.*]] = fir.string_lit "('ok')"(6) : !fir.char<1,6>
! CHECK: fir.has_value %[[lit]] : !fir.char<1,6>
! CHECK: }