[Beignet] *** SPAM LEVEL 4.054 *** Re: [PATCH] Pass user options to clang.

Boqun Feng boqun.feng at intel.com
Wed May 29 20:30:43 PDT 2013


On Thu, May 30, 2013 at 11:20:28AM +0800, Zhigang Gong wrote:
> I think I know the reason.
> 
> As you define start, end as uint32_t not size_t, so on 64 bit system,
> The following condition check will always be true. As npos is a uint64_t -1.
> It's bigger than any uint32_t value.
> 
> while (end != std::string::npos)   

Yes, I modify uint32_t to size_t, it will not hang again.

> 
> > -----Original Message-----
> > From: beignet-bounces+zhigang.gong=linux.intel.com at lists.freedesktop.org
> >
> [mailto:beignet-bounces+zhigang.gong=linux.intel.com at lists.freedesktop.org]
> > On Behalf Of Yang, Rong R
> > Sent: Thursday, May 30, 2013 10:30 AM
> > To: Zhigang Gong; 'Simon Richter'; beignet at lists.freedesktop.org
> > Subject: Re: [Beignet] *** SPAM LEVEL 4.054 *** Re: [PATCH] Pass user
> options
> > to clang.
> > 
> > Hi,
> > 
> >   About options.substr(start, end - start), if end is -1, end-start will
> very large.
> > Per string::substr reference,
> > 
> > string substr (size_t pos = 0, size_t len = npos) const;
> > len:
> > Number of characters to include in the substring (if the string is
> shorter, as
> > many characters as possible are used).
> > 
> >   So also can get correct substr.
> > 
> > Hi, Simon,
> > 
> >    Can you have a look at the vector args's element value at
> > clang::CompilerInvocation::CreateFromArgs before you hang?
> > 
> > -----Original Message-----
> > From: Zhigang Gong [mailto:zhigang.gong at linux.intel.com]
> > Sent: Thursday, May 30, 2013 10:20 AM
> > To: 'Simon Richter'; beignet at lists.freedesktop.org
> > Cc: Yang, Rong R
> > Subject: RE: [Beignet] *** SPAM LEVEL 4.054 *** Re: [PATCH] Pass user
> options
> > to clang.
> > 
> > Hi,
> > 
> > I can't reproduce this hang. And I recheck the patch and found one
> potential
> > problem:
> > 
> > -  static void buildModuleFromSource(const char* input, const char*
> output) {
> > +  static void buildModuleFromSource(const char* input, const char*
> > + output,
> > std::string options) {
> >      // Arguments to pass to the clang frontend
> >      vector<const char *> args;
> > +    bool bOpt = true;
> > +
> > +    vector<std::string> useless; //hold substrings to avoid c_str free
> > +    uint32_t start = 0, end = 0;
> > +    /* clang unsupport options:
> > +       -cl-denorms-are-zero, -cl-strict-aliasing
> > +       -cl-no-signed-zeros, -cl-fp32-correctly-rounded-divide-sqrt
> > +       all support options, refer to
> clang/include/clang/Driver/Options.inc
> > +       Maybe can filter these options to avoid warning
> > +    */
> > +    while (end != std::string::npos) {
> > +      end = options.find(' ', start);
> > For the last argument which is not ended by a space, then the end should
> be a
> > npos which is -1.
> > Then it may cause problem. Yang Rong, could you confirm and fix this
> potential
> > problem?
> > +      std::string str = options.substr(start, end - start);
> > +      if(str.size() == 0)
> > +        continue;
> > +      if(str == "-cl-opt-disable") bOpt = false;
> > +      useless.push_back(str);
> > +      args.push_back(str.c_str());
> > +      start = end + 1;
> > +    }
> > +
> > 
> > > -----Original Message-----
> > > From:
> > > beignet-bounces+zhigang.gong=linux.intel.com at lists.freedesktop.org
> > >
> >
> [mailto:beignet-bounces+zhigang.gong=linux.intel.com at lists.freedesktop.org]
> > > On Behalf Of Simon Richter
> > > Sent: Wednesday, May 29, 2013 5:49 PM
> > > To: beignet at lists.freedesktop.org
> > > Subject: [Beignet] *** SPAM LEVEL 4.054 *** Re: [PATCH] Pass user
> > > options
> > to
> > > clang.
> > >
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA1
> > >
> > > Hi,
> > >
> > > On 29.05.2013 05:20, Yang Rong wrote:
> > >
> > > > clang do not support all options in opencl. clang unsupport
> > > > options: -cl-denorms-are-zero, -cl-strict-aliasing
> > > > -cl-no-signed-zeros, -cl-fp32-correctly-rounded-divide-sqrt all
> > > > support options, refer to clang/include/clang/Driver/Options.inc
> > > > Can ignore these options to avoid warning.
> > >
> > > Starting from this commit, the "compiler_clod" test (i.e. the first
> > > test) hangs with 100% CPU.
> > >
> > >    Simon
> > > -----BEGIN PGP SIGNATURE-----
> > > Version: GnuPG v1.4.12 (GNU/Linux)
> > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> > >
> > > iJwEAQECAAYFAlGlzxkACgkQ0sfeulffv7vYqQQAifBRUmvmMdq9XF/6qJZ4+Pa/
> > >
> > kRqqvjukrxscJb8GuToFCcarpvh5Vq+qnDwngRMMf9oD3thTus/p3W4OBTThz5vK
> > >
> > UuQ2jRR0AyRtbFYVrdQy8g6M6UEPZ60wZMvlXluclNw2nE6sf2zIG8TZw+cDhM
> > > Gb
> > > 0Q0fbad+Q8Diqy2jY08=
> > > =KEYY
> > > -----END PGP SIGNATURE-----
> > > _______________________________________________
> > > Beignet mailing list
> > > Beignet at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/beignet
> > 
> > _______________________________________________
> > Beignet mailing list
> > Beignet at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/beignet
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list