Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Checks/PWR080/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ typedef enum {
OPTION_UNKNOWN,
} TransformOption;

double transform_and_sum(const double *array, size_t size,
TransformOption option) {
__attribute__((pure)) double transform_and_sum(const double *array, size_t size,
TransformOption option) {
double sum = 0.0;

double factor;
Expand Down Expand Up @@ -146,6 +146,7 @@ the specified transformation:
! example.f90

module options
implicit none
integer, parameter :: OPTION_HALF = 1
integer, parameter :: OPTION_DOUBLE = 2
integer, parameter :: OPTION_UNKNOWN = 3
Expand All @@ -163,7 +164,7 @@ program main

contains

real(kind=real32) function transform_and_sum(array, option)
pure real(kind=real32) function transform_and_sum(array, option)
implicit none

real(kind=real32), intent(in) :: array(:)
Expand Down
4 changes: 2 additions & 2 deletions Checks/PWR080/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ typedef enum {
OPTION_UNKNOWN,
} TransformOption;

double transform_and_sum(const double *array, size_t size,
TransformOption option) {
__attribute__((pure)) double transform_and_sum(const double *array, size_t size,
TransformOption option) {
double sum = 0.0;

double factor;
Expand Down
3 changes: 2 additions & 1 deletion Checks/PWR080/example.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
! PWR080: Conditionally initialized variables can lead to undefined behavior

module options
implicit none
integer, parameter :: OPTION_HALF = 1
integer, parameter :: OPTION_DOUBLE = 2
integer, parameter :: OPTION_UNKNOWN = 3
Expand All @@ -18,7 +19,7 @@ program main

contains

real(kind=real32) function transform_and_sum(array, option)
pure real(kind=real32) function transform_and_sum(array, option)
implicit none

real(kind=real32), intent(in) :: array(:)
Expand Down
4 changes: 2 additions & 2 deletions Checks/PWR080/solution.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ typedef enum {
OPTION_UNKNOWN,
} TransformOption;

double transform_and_sum(const double *array, size_t size,
TransformOption option) {
__attribute__((pure)) double transform_and_sum(const double *array, size_t size,
TransformOption option) {
double sum = 0.0;

// Identity transformation by default
Expand Down
3 changes: 2 additions & 1 deletion Checks/PWR080/solution.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
! PWR080: Conditionally initialized variables can lead to undefined behavior

module options
implicit none
integer, parameter :: OPTION_HALF = 1
integer, parameter :: OPTION_DOUBLE = 2
integer, parameter :: OPTION_UNKNOWN = 3
Expand All @@ -18,7 +19,7 @@ program main

contains

real(kind=real32) function transform_and_sum(array, option)
pure real(kind=real32) function transform_and_sum(array, option)
implicit none

real(kind=real32), intent(in) :: array(:)
Expand Down