PreSync circumvents scoping of Cactus grid functions for C/C++ functions.

Create issue
Issue #2369 resolved
Steven R. Brandt created an issue

As implemented, the header generated for DECLARE_CCTK_ARGUMENTS_func does not check to see whether the thorn has access to a GF that it wants to read or write. In Fortran, this will lead to a compile time error, but in C/C++, the header will simply grant access to the variable.

Comments (9)

  1. Steven R. Brandt reporter

    So the only thing that needs to be done here is convert warnings to errors. Correct?

    diff --git a/lib/sbin/rdwr.pl b/lib/sbin/rdwr.pl
    index 24b3cf12..e1be427c 100644
    --- a/lib/sbin/rdwr.pl
    +++ b/lib/sbin/rdwr.pl
    @@ -527,7 +527,7 @@ sub create_macros
                     $hint = "Check variable or group '${th}::$full_var' and verify ".
                         "correct implementation/thorn name and variable name.'";
                   }
    -              &CST_error(1, "Error in read/write declaration of '${th}::$full_var' for '$nm' in schedule."
    +              &CST_error(0, "Error in read/write declaration of '${th}::$full_var' for '$nm' in schedule."
                         ,$hint, $errline, $ccl_file);
                   next;
                 }
    @@ -536,7 +536,7 @@ sub create_macros
                 # the variable type...
                 if($vtype eq "CCTK_") {
                   my $hint = "Bad variable group name '$full_var' at $errline";
    -              &CST_error(1, "Error in read/write declaration $nm schedule. Check variable or group '$full_var'" .
    +              &CST_error(0, "Error in read/write declaration $nm schedule. Check variable or group '$full_var'" .
                         ' and verify correct implementation/thorn name and variable name.'
                         ,$hint, $errline, $ccl_file);
                   next;
    @@ -569,7 +569,7 @@ sub create_macros
                     if(!defined($decls->{$full_var})) {
                       my $line = $reads_writes->{$namekey}->{$th}->{$full_var}->{line};
                       my $hint = "Check access of variable. Maybe add an inherits clause to your interface.ccl";
    -                  &CST_error(1, "No access to variable '${th}::$ifull_var'"
    +                  &CST_error(0, "No access to variable '${th}::$ifull_var'"
                         ,$hint, $line, $ccl_file);
                     }
                     $$data .= qq($vtype $const * restrict const $ifull_var __attribute__((__unused__)) = (($vtype *) CCTKi_VarDataPtrI(cctkGH, $timelevel, CCTK_JOIN_TOKENS(cctki_vi_, CCTK_THORN).$ivar));; /* group $group_register */\\\n);
    @@ -584,7 +584,7 @@ sub create_macros
                   if(!defined($decls->{$full_var})) {
                     my $line = $reads_writes->{$namekey}->{$th}->{$full_var}->{line};
                     my $hint = "Check access of variable. Maybe add an inherits clause to your interface.ccl";
    -                &CST_error(1, "No access to variable '${th}::$ifull_var'"
    +                &CST_error(0, "No access to variable '${th}::$ifull_var'"
                       ,$hint, $line, $ccl_file);
                   }
                   $$data .= qq($vtype $const * restrict const $ifull_var __attribute__((__unused__)) = (($vtype *) CCTKi_VarDataPtrI(cctkGH, $timelevel, CCTK_JOIN_TOKENS(cctki_vi_, CCTK_THORN).$ivar));; /* TL: $namekey --> $timelevel $group_register*/\\\n);
    

  2. Roland Haas

    I believe so, yes. And check that these are actually warnings that we want to be errors. I had hoped that we had created a ticket or list of changes for this while adding PreSync to master (there was at least one ticket about turning the original errors into warnings but I cannot really find it anymore).

    This was planned to happen very shortly after the Turing release but with the gcc/gfortran-10 mess it was forgotten.

    #2468 lists a couple more candidates.

  3. Steven R. Brandt reporter

    @Roland Haas I think the above are the changes related to the subject of this ticket.

  4. Log in to comment