Giter Site home page Giter Site logo

Comments (10)

nncarlson avatar nncarlson commented on June 23, 2024

This is with "-fcheck=all -Wall -Wextra", which cmake uses for the Debug build type. No error with Release build type.

from petaca.

mattbement avatar mattbement commented on June 23, 2024

The following program demonstrates the issue, when compiled with gfortran -g -fcheck=all -Wall -Wextra junk.F90. Interestingly, changing the reshaped shape to shape=[2,1], makes the error go away. As it stands, I don't think this is a major problem, since the Release build test passes (and it would fail if the assignment were getting truly messed up).

module junk
  use, intrinsic :: iso_fortran_env

  type, abstract, public :: parameter_entry
    !! meta data associated with the parameter will go here
  end type

  type, extends(parameter_entry), public :: any_matrix
    private
    class(*), allocatable :: value(:,:)
  contains
    procedure :: set_value => set_matrix_value
    generic   :: get_value => get_matrix_int32
    procedure, private :: get_matrix_int32
  end type

  interface any_matrix
    procedure any_matrix_value
  end interface

contains

  function any_matrix_value (value) result (obj)
    class(*), intent(in) :: value(:,:)
    type(any_matrix) :: obj
    call set_matrix_value (obj, value)
  end function any_matrix_value

  subroutine set_matrix_value (this, value)
    class(any_matrix), intent(out) :: this
    class(*), intent(in) :: value(:,:)
    allocate(this%value(lbound(value,1):ubound(value,1),&
                        lbound(value,2):ubound(value,2)), source=value)
  end subroutine set_matrix_value

  !! Return a int32 kind integer value.
  subroutine get_matrix_int32 (this, value, errc)
    class(any_matrix), intent(in) :: this
    integer(int32), allocatable :: value(:,:)
    logical, intent(out) :: errc
    select type (v => this%value)
    type is (integer(int32))
      value = v
      errc = .false.
    class default
      errc = .true.
    end select
  end subroutine



end module

program stuff
  use junk
  
  type(any_matrix) :: x, y
  call x%set_value (reshape([1,2],shape=[1,2]))
  y = x
 

end program

from petaca.

nncarlson avatar nncarlson commented on June 23, 2024

The other thing I noticed is the slew of warning messages during compilation about variables possibly being used before defined, but they were compiler-generated variables, members of structs for array dope vectors, etc. That's not right at all.

from petaca.

nncarlson avatar nncarlson commented on June 23, 2024

Same problems for gfortran 9.1

from petaca.

zbeekman avatar zbeekman commented on June 23, 2024

@mattbement did you submit a bug report with your reproducer code? That seems small enough, and the problem large enough, that it should get some traction. Please let me know if you want/need help and ping me with a link to the bug tracker if you are able to get around to submitting it. If you don't have time let me know an I can do it.

Thanks!

from petaca.

mattbement avatar mattbement commented on June 23, 2024

@zbeekman - I've not submitted to gcc bugzilla before - so if you're willing, that would be great!

from petaca.

zbeekman avatar zbeekman commented on June 23, 2024

The other thing I noticed is the slew of warning messages during compilation about variables possibly being used before defined, but they were compiler-generated variables, members of structs for array dope vectors, etc. That's not right at all.

Yes this is very annoying. It would be a super useful warning if it weren't for all the false positives/errant output. I've taken to adding -Wno-maybe-undefined

from petaca.

zmiimz avatar zmiimz commented on June 23, 2024

I have 9.1.1 version and

Test project /home/term/Programs/petaca/petaca/build
Start 1: fortran_dynamic_loader
1/20 Test #1: fortran_dynamic_loader ........... Passed 0.04 sec
Start 2: map_any
2/20 Test #2: map_any .......................... Passed 0.01 sec
Start 3: any_scalar
3/20 Test #3: any_scalar ....................... Passed 0.00 sec
Start 4: any_vector
4/20 Test #4: any_vector ....................... Passed 0.00 sec
Start 5: any_matrix
5/20 Test #5: any_matrix ....................... Passed 0.01 sec
Start 6: parameter_list
6/20 Test #6: parameter_list ................... Passed 0.00 sec
Start 7: parameter_list_json
7/20 Test #7: parameter_list_json .............. Passed 0.00 sec
Start 8: state_history
8/20 Test #8: state_history .................... Passed 0.00 sec
Start 9: secure_hash
9/20 Test #9: secure_hash ...................... Passed 0.50 sec
Start 10: timer_tree
10/20 Test #10: timer_tree ....................... Passed 2.19 sec
Start 11: strip-file1
11/20 Test #11: strip-file1 ...................... Passed 0.01 sec
Start 12: json-ex1
12/20 Test #12: json-ex1 ......................... Passed 0.00 sec
Start 13: json-ex2
13/20 Test #13: json-ex2 ......................... Passed 0.00 sec
Start 14: json-ex3
14/20 Test #14: json-ex3 ......................... Passed 0.00 sec
Start 15: json-ex4
15/20 Test #15: json-ex4 ......................... Passed 0.00 sec
Start 16: json-ex5
16/20 Test #16: json-ex5 ......................... Passed 0.00 sec
Start 17: json-ex6
17/20 Test #17: json-ex6 ......................... Passed 0.00 sec
Start 18: json-ex7
18/20 Test #18: json-ex7 ......................... Passed 0.00 sec
Start 19: json-ex8
19/20 Test #19: json-ex8 ......................... Passed 0.00 sec
Start 20: json-ex9
20/20 Test #20: json-ex9 ......................... Passed 0.00 sec

100% tests passed, 0 tests failed out of 20

gfortran --version
GNU Fortran (SUSE Linux) 9.1.1 20190527 [gcc-9-branch revision 271644]

from petaca.

mattbement avatar mattbement commented on June 23, 2024

Forgive a dumb question - this is the debug build?

from petaca.

zmiimz avatar zmiimz commented on June 23, 2024

ok, you are right, I forgot to switch to debug :/

Test project /home/term/Programs/petaca/petaca/build
Start 1: fortran_dynamic_loader
1/20 Test #1: fortran_dynamic_loader ........... Passed 0.04 sec
Start 2: map_any
2/20 Test #2: map_any .......................... Passed 0.00 sec
Start 3: any_scalar
3/20 Test #3: any_scalar ....................... Passed 0.00 sec
Start 4: any_vector
4/20 Test #4: any_vector ....................... Passed 0.00 sec
Start 5: any_matrix
5/20 Test #5: any_matrix .......................***Failed 0.02 sec
Start 6: parameter_list
6/20 Test #6: parameter_list ...................***Failed 0.01 sec
Start 7: parameter_list_json
7/20 Test #7: parameter_list_json .............. Passed 0.00 sec
Start 8: state_history
8/20 Test #8: state_history .................... Passed 0.00 sec
Start 9: secure_hash
9/20 Test #9: secure_hash ...................... Passed 0.41 sec
Start 10: timer_tree
10/20 Test #10: timer_tree ....................... Passed 2.42 sec
Start 11: strip-file1
11/20 Test #11: strip-file1 ...................... Passed 0.06 sec
Start 12: json-ex1
12/20 Test #12: json-ex1 ......................... Passed 0.00 sec
Start 13: json-ex2
13/20 Test #13: json-ex2 ......................... Passed 0.00 sec
Start 14: json-ex3
14/20 Test #14: json-ex3 ......................... Passed 0.00 sec
Start 15: json-ex4
15/20 Test #15: json-ex4 ......................... Passed 0.00 sec
Start 16: json-ex5
16/20 Test #16: json-ex5 ......................... Passed 0.00 sec
Start 17: json-ex6
17/20 Test #17: json-ex6 ......................... Passed 0.00 sec
Start 18: json-ex7
18/20 Test #18: json-ex7 ......................... Passed 0.00 sec
Start 19: json-ex8
19/20 Test #19: json-ex8 ......................... Passed 0.00 sec
Start 20: json-ex9
20/20 Test #20: json-ex9 ......................... Passed 0.00 sec

90% tests passed, 2 tests failed out of 20

from petaca.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.