Issue with passing NULL as argument in 4.8.5

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with passing NULL as argument in 4.8.5

gcc - Help mailing list
Hi,
There is a code as below
typename GraphT::SizeT Validate_Results(
    util::Parameters &parameters, GraphT &graph, typename GraphT::VertexT src,
    LabelT *h_labels, typename GraphT::VertexT *h_preds,
    LabelT *ref_labels = (LabelT*)NULL,
    typename GraphT::VertexT *ref_preds = NULL,
    bool verbose = true) {

which is called like this:
      SizeT num_errors = app::bfs::Validate_Results(
          parameters, graph, src, h_labels, h_preds,
          ref_labels == NULL ? NULL : ref_labels[run_num % num_srcs],
          NULL,
          false);


However, gcc 4.8.5 has problem with passing NULL with the 7th argument.


/home/mahmood/gunrock-1.0/examples/bfs/test_bfs.cu:120:62:   required from here
/home/mahmood/gunrock-1.0/gunrock/app/bfs/bfs_app.cu:114:166: error: no matching function for call to ‘Validate_Results(gunrock::util::Parameters&, gunrock::app::TestGraph<long unsigned int, long unsigned int, unsigned int, 768u, 0u>&, VertexT&, long unsigned int*&, VertexT*&, long unsigned int*, NULL, bool)’
       SizeT num_errors = app::bfs::Validate_Results(
                                                                                                                                                                      ^
/home/mahmood/gunrock-1.0/gunrock/app/bfs/bfs_app.cu:114:166: note: candidate is:
/home/mahmood/gunrock-1.0/gunrock/app/bfs/bfs_test.cuh:132:1: note: template<class GraphT, class LabelT> typename GraphT::SizeT gunrock::app::bfs::Validate_Results(gunrock::util::Parameters&, GraphT&, typename GraphT::VertexT, LabelT*, typename GraphT::VertexT*, LabelT*, typename GraphT::VertexT*, bool)
 typename GraphT::SizeT Validate_Results(
 ^
/home/mahmood/gunrock-1.0/gunrock/app/bfs/bfs_test.cuh:132:1: note:   template argument deduction/substitution failed:
/home/mahmood/gunrock-1.0/gunrock/app/bfs/bfs_app.cu:114:166: note:   mismatched types ‘typename GraphT::VertexT*’ and ‘long int’
       SizeT num_errors = app::bfs::Validate_Results(
                                                                                                                                                                      ^



I have confused on how to solve that. Any idea?



Regards,
Mahmood
Reply | Threaded
Open this post in threaded view
|

Re: Issue with passing NULL as argument in 4.8.5

Jonathan Wakely-4
On Sat, 26 Oct 2019 at 22:15, Mahmood Naderan via gcc-help
<[hidden email]> wrote:

>
> Hi,
> There is a code as below
> typename GraphT::SizeT Validate_Results(
>     util::Parameters &parameters, GraphT &graph, typename GraphT::VertexT src,
>     LabelT *h_labels, typename GraphT::VertexT *h_preds,
>     LabelT *ref_labels = (LabelT*)NULL,
>     typename GraphT::VertexT *ref_preds = NULL,
>     bool verbose = true) {
>
> which is called like this:
>       SizeT num_errors = app::bfs::Validate_Results(
>           parameters, graph, src, h_labels, h_preds,
>           ref_labels == NULL ? NULL : ref_labels[run_num % num_srcs],
>           NULL,
>           false);
>
>
> However, gcc 4.8.5 has problem with passing NULL with the 7th argument.
>
>
> /home/mahmood/gunrock-1.0/examples/bfs/test_bfs.cu:120:62:   required from here
> /home/mahmood/gunrock-1.0/gunrock/app/bfs/bfs_app.cu:114:166: error: no matching function for call to ‘Validate_Results(gunrock::util::Parameters&, gunrock::app::TestGraph<long unsigned int, long unsigned int, unsigned int, 768u, 0u>&, VertexT&, long unsigned int*&, VertexT*&, long unsigned int*, NULL, bool)’
>        SizeT num_errors = app::bfs::Validate_Results(
>                                                                                                                                                                       ^
> /home/mahmood/gunrock-1.0/gunrock/app/bfs/bfs_app.cu:114:166: note: candidate is:
> /home/mahmood/gunrock-1.0/gunrock/app/bfs/bfs_test.cuh:132:1: note: template<class GraphT, class LabelT> typename GraphT::SizeT gunrock::app::bfs::Validate_Results(gunrock::util::Parameters&, GraphT&, typename GraphT::VertexT, LabelT*, typename GraphT::VertexT*, LabelT*, typename GraphT::VertexT*, bool)
>  typename GraphT::SizeT Validate_Results(
>  ^
> /home/mahmood/gunrock-1.0/gunrock/app/bfs/bfs_test.cuh:132:1: note:   template argument deduction/substitution failed:
> /home/mahmood/gunrock-1.0/gunrock/app/bfs/bfs_app.cu:114:166: note:   mismatched types ‘typename GraphT::VertexT*’ and ‘long int’
>        SizeT num_errors = app::bfs::Validate_Results(
>                                                                                                                                                                       ^
>
>
>
> I have confused on how to solve that. Any idea?

Has somebody redefined NULL in your code base?

Compile with -save-temps and check the .ii file to see what the NULL
macro expands to at that point.