Access Softek1 open job

Compiler Developer (LLVM, C++)

Systems, C++ and performancePosted over 2 months agovia Himalayas, a remote job board

Work type
RemoteOpen worldwide
Experience
Not stated
Pay
Not listed
Posted
Over 2 months agoOpen 2 months
Before you apply: make your resume fit this job

Skills it mentions

Add your skills to see which ones you have.

Interview questions for this job6 with answers below, on C++, C, Python and 1 more

About the job

Access Softek is a recognized name with an established reputation in the LLVM community.From early on in LLVM’s origins, we have worked on a number of projects such as a front-end compiler, back-end code generation / optimizations, linkers, code instrumentation, and did so with a focus of targeting different platforms - from well-known platforms to those that are new, quite unique and not yet publicly available.We "own" and host the LLVM Lab, and orchestrate the continued integration (LLVM buildbot) for all projects under the LLVM umbrella.We are growing our team, and are looking for experienced Compiler Engineers to work on the LLVM and Clang based toolchain. Our product is a set of instruments that includes the Clang compiler, a linker, tools, and libraries adapted and optimized to build safe, efficient applications.

As a member of the toolchain team, you will:

  • analyze the requirements, research, design, enhance and implement different components of the toolchain to meet the clients needs;
  • extend the open source LLVM, Clang, binutils code bases to support the client's platform;
  • closely collaborate with the LLVM community and contribute public patches to the LLVM and Clang repository;
  • analyze, build and debug the platform code and platform specific tests, analyze and identify system level issues;
  • develop new and maintain the existing target specific tests.

Required qualifications:

  • expert knowledge of C/C++;
  • experience in overall design of compilers, code generation and optimization;
  • cross-compilation using GCC or Clang;
  • in-depth understanding of multithreading, object-oriented analysis and design;
  • version control systems;
  • good self-motivation, ability to work independently;
  • strong track record of building high performance, production quality software;
  • passion for writing clean and effective code;
  • good English, strong communication and teamwork skills.

Nice to have qualifications:

  • knowledge of the C++11 / C++14/C++17 features;
  • knowledge of assemblers, linkers, object file formats, debuggers and experience using them;
  • familiarity with *nix tools, CMake, make;
  • scripting languages such as Python and bash.

Our benefits:

  • Work from anywhere in the world!
  • Flexible working hours
  • Experienced development teams
  • Long-term employment
  • Competitive salary
  • Paid vacation and days off on national holidays
  • Paid sick leave and internal medical insurance policy
  • Mental health coverage
  • Global corporate events for all staff
  • Compensation for training and additional education
  • Community of practice, regular knowledge sharing among colleagues
  • Provision of computer equipment
  • Internet compensation (50$ per month)
  • Relocation compensation package to be discussed individually
  • And other benefits, described in detail in the Staff Handbook

Originally posted on Himalayas

Interested?Compiler Developer (LLVM, C++) at Access Softek

Apply on Himalayas (opens in a new tab)

The job ad ends here

Interview questions for this job6 with answers, on C++, C, Python and 1 more

Interview questions for this job

For the skills the ad mentions: C++, C, Python and Shell scripting.

233 questions
  • When should static_cast, dynamic_cast, const_cast, and reinterpret_cast be used?C++

    static_cast

    static_cast is the first cast you should attempt to use. It does things like implicit conversions between types (such as int to float, or pointer to void*), and it can also call explicit conversion functions (or implicit ones). In many cases, explicitly stating static_cast isn't necessary, but it's important to note that the T(something) syntax is equivalent to (T)something and should be avoided (more on that later). A T(something, something_else) is safe, however, and guaranteed to call the constructor.

    static_cast can also cast through inheritance hierarchies. It is unnecessary when casting upwards (towards a base class), but when casting downwards it can be used as long as it doesn't cast through virtual inheritance. It does not do checking, however, and it is undefined behavior to static_cast down a hierarchy to a type that isn't actually the type of the object.

    const_cast

    const_cast can be used to remove or add const to a variable; no other C++ cast is capable of removing it (not even reinterpret_cast). It is important to note that modifying a formerly const value is only undefined if the original variable is const; if you use it to take the const off a reference to something that wasn't declared with const, it is safe. This can be useful when overloading member functions based on const, for instance. It can also be used to add const to an object, such as to call a member function overload.

    const_cast also works similarly on volatile, though that's less common.

    dynamic_cast

    dynamic_cast is exclusively used for handling polymorphism. You can cast a pointer or reference to any polymorphic type to any other class type (a polymorphic type has at least one virtual function, declared or inherited). You can use it for more than just casting downwards – you can cast sideways or even up another chain. The dynamic_cast will seek out the desired object and return it if possible. If it can't, it will return nullptr in the case of a pointer, or throw std::bad_cast in the case of a reference.

    dynamic_cast has some limitations, though. It doesn't work if there are multiple objects of the same type in the inheritance hierarchy (the so-called 'dreaded diamond') and you aren't using virtual inheritance. It also can only go through public inheritance - it will always fail to travel through protected or private inheritance. This is rarely an issue, however, as such forms of inheritance are rare.

    reinterpret_cast

    reinterpret_cast is the most dangerous cast, and should be used very sparingly. It turns one type directly into another — such as casting the value from one pointer to another, or storing a pointer in an int, or all sorts of other nasty things. Largely, the only guarantee you get with reinterpret_cast is that normally if you cast the result back to the original type, you will get the exact same value (but not if the intermediate type is smaller than the original type). There are a number of conversions that reinterpret_cast cannot do, too. It's often abused for particularly weird conversions and bit manipulations, like turning a raw data stream into actual data, or storing data in the low bits of a pointer to aligned data. For those cases, see std::bit_cast.

    C-Style Cast and Function-Style Cast

    C-style cast and function-style cast are casts using (type)object or type(object), respectively, and are functionally equivalent. They are defined as the first of the following which succeeds:

    • const_cast
    • static_cast (though ignoring access restrictions)
    • static_cast (see above), then const_cast
    • reinterpret_cast
    • reinterpret_cast, then const_cast

    Read the rest at the sourceFrom Stack Overflow: asked by James Eichele, answered by coppro (CC BY-SA 4.0)

  • What is the strict aliasing rule?C

    A typical situation where you encounter strict aliasing problems is when overlaying a struct (like a device/network message) onto a buffer of the word size of your system (like a pointer to uint32_ts or uint16_ts). When you overlay a struct onto such a buffer, or a buffer onto such a struct through pointer casting you can easily violate strict aliasing rules.

    So in this kind of setup, if I want to send a message to something I'd have to have two incompatible pointers pointing to the same chunk of memory. I might then naively code something like this:

    #include <stdint.h>
    #include <stdlib.h>
    #include <stdio.h>
    typedef struct Msg {
        uint32_t a;
        uint32_t b;
    } Msg;
    // Sends a buffer over a 16-bit channel
    void SendWords(uint16_t *buf, size_t sz) {
        for(size_t i = 0; i < sz; ++i)
            printf("%.4x ", buf[i]);
        printf("\n");
    }
    int main(void) {
        Msg msg;
        // Send a bunch of messages
        for(int i = 0; i < 10; ++i) {
            msg.a = 0xDEADBEEF;
            msg.b = i;
            SendWords((uint16_t*)&msg, sizeof(msg)/sizeof(uint16_t));
        }
    }
    

    The strict aliasing rule makes this setup illegal: dereferencing a pointer that aliases an object that is not of a compatible type or one of the other types allowed by C 2011 6.5 paragraph 71 is undefined behavior. Unfortunately, you can still code this way, maybe get some warnings, have it compile fine, only to have weird unexpected behavior when you run the code. For example, when I compiled it with gcc -O2 it produced this very unexpected output:

    0000 0000 0000 0000
    0000 0000 0000 0000
    0000 0000 0000 0000
    ...
    

    See this snippet on Compiler Explorer for how GCC and Clang both produce different unintended outputs.

    To see why this behavior is undefined, we have to think about what the strict aliasing rule buys the compiler. Following this rule, the writes to msg cannot alias the reads of buf in SendWords. Consequently, an optimizing compiler can reorder the instructions, so that all assignments to msg happen before or after all the reads from buf in SendWords. In turn, it can then deduce that buf[0], ..., buf[3] can be loaded from memory before the loop is executed, or that only the msg values from the last iteration of the loop need to be calculated. Either way, removing the redundant stores and loads (under this rule) makes the generated code faster. Before strict aliasing was introduced, the compiler had to live in a state of paranoia that the contents of buf could change by any preceding memory stores. So to get an extra performance edge, and assuming most people don't type-pun pointers, the strict aliasing rule was introduced.

    So how do I get around this?

    Read the rest at the sourceFrom Stack Overflow: asked by Benoit, answered by Doug T. (CC BY-SA 4.0)

  • How do I check whether a file exists without exceptions?Python

    If the reason you're checking is so you can do something like if file_exists: open_it(), it's safer to use a try around the attempt to open it. Checking and then opening risks the file being deleted or moved or something between when you check and when you try to open it.

    If you're not planning to open the file immediately, you can use os.path.isfile if you need to be sure it's a file.

    Return True if path is an existing regular file. This follows symbolic links, so both islink() and isfile() can be true for the same path.

    import os.path
    os.path.isfile(fname)
    

    pathlib

    Starting with Python 3.4, the pathlib module offers an object-oriented approach (backported to pathlib2 in Python 2.7):

    from pathlib import Path
    my_file = Path("/path/to/file")
    if my_file.is_file():
        # file exists
    

    To check a directory, do:

    if my_file.is_dir():
        # directory exists
    

    To check whether a Path object exists independently of whether is it a file or directory, use exists():

    if my_file.exists():
        # path exists
    

    You can also use resolve(strict=True) in a try block:

    try:
        my_abs_path = my_file.resolve(strict=True)
    except FileNotFoundError:
        # doesn't exist
    else:
        # exists
    

    From Stack Overflow: asked by spence91, answered by rslite (CC BY-SA 4.0)

  • How can I get my external IP address in a shell script?Shell scripting

    I'd recommend getting it directly from a DNS server.

    Most of the other answers below all involve going over HTTP to a remote server. Some of them required parsing of the output, or relied on the User-Agent header to make the server respond in plain text. Those change quite frequently (go down, change their name, put up ads, might change output format etc.).

    1. The DNS response protocol is standardised (the format will stay compatible).
    2. Historically, DNS services (Akamai, Google Public DNS, OpenDNS, ..) tend to survive much longer and are more stable, more scalable, and generally more looked-after than whatever new hip whatismyip dot-com HTTP service is hot today.
    3. This method is inherently faster (be it only by a few milliseconds!).

    Using dig with an OpenDNS resolver:

    $ dig @resolver4.opendns.com myip.opendns.com +short
    

    Perhaps alias it in your bashrc so it's easy to remember

    # https://unix.stackexchange.com/a/81699/37512
    alias wanip='dig @resolver4.opendns.com myip.opendns.com +short' 
    alias wanip4='dig @resolver4.opendns.com myip.opendns.com +short -4'
    alias wanip6='dig @resolver1.ipv6-sandbox.opendns.com AAAA myip.opendns.com +short -6'
    

    Responds with a plain ip address:

    $ wanip # wanip4, or wanip6
    80.100.192.168 # or, 2606:4700:4700::1111
    

    How it works

    The dig command.

    (Abbreviated from https://ss64.com/bash/dig.html. You can read this anytime via man dig):

    usage:  dig [@global-dnsserver] [q-type] <hostname> <d-opt> [q-opt]
        q-type   one of (A, ANY, AAAA, TXT, MX, ...). Default: A.
        d-opt    ...
                 +[no]short          (Display nothing except short form of answer)
                 ...
        q-opt    one of:
                 -4                  (use IPv4 query transport only)
                 -6                  (use IPv6 query transport only)
                 ...
    

    The ANY query type returns either an AAAA or an A record. To prefer IPv4 or IPv6 connection specifically, use the -4 or -6 options accordingly.

    To require the response be an IPv4 address, replace ANY with A; for IPv6, replace it with AAAA. Note that it can only return the address used for the connection. For example, when connecting over IPv6, it cannot return the A address.

    Alternative servers

    Various DNS providers offer this service, including OpenDNS, Akamai, and Google Public DNS:

    # OpenDNS (since 2009)
    $ dig @resolver3.opendns.com myip.opendns.com +short
    $ dig @resolver4.opendns.com myip.opendns.com +short
    80.100.192.168
    # OpenDNS IPv6
    $ dig @resolver1.ipv6-sandbox.opendns.com AAAA myip.opendns.com +short -6
    2606:4700:4700::1111
    # Akamai (since 2009)
    $ dig @ns1-1.akamaitech.net ANY whoami.akamai.net +short
    80.100.192.168
    # Akamai approximate
    # NOTE: This returns only an approximate IP from your block,
    # but has the benefit of working even when behind private DNS proxies.
    $ dig +short TXT whoami.ds.akahelp.net
    "ip" "80.100.192.160"
    # Google (since 2010)
    # Supports IPv6 + IPv4, use -4 or -6 to force one.
    $ dig @ns1.google.com TXT o-o.myaddr.l.google.com +short
    "80.100.192.168"
    

    Example alias that specifically requests an IPv4 address:

    # https://unix.stackexchange.com/a/81699/37512
    alias wanip4='dig @resolver4.opendns.com myip.opendns.com +short -4'
    $ wanip4
    80.100.192.168
    

    And for your IPv6 address:

    # https://unix.stackexchange.com/a/81699/37512
    alias wanip6='dig @ns1.google.com TXT o-o.myaddr.l.google.com +short -6'
    $ wanip6
    "2606:4700:4700::1111"
    

    Troubleshooting

    Read the rest at the sourceFrom Unix & Linux Stack Exchange: asked by Eugene Yarmash, answered by Timo Tijhof (CC BY-SA 4.0)

  • What's the problem with "using namespace std;"?C++

    Consider two libraries called Foo and Bar:

    using namespace foo;
    using namespace bar;
    

    Everything works fine, and you can call Blah() from Foo and Quux() from Bar without problems. But one day you upgrade to a new version of Foo 2.0, which now offers a function called Quux(). Now you've got a conflict: Both Foo 2.0 and Bar import Quux() into your global namespace. This is going to take some effort to fix, especially if the function parameters happen to match.

    If you had used foo::Blah() and bar::Quux(), then the introduction of foo::Quux() would have been a non-event.

    From Stack Overflow: asked by akbiggs, answered by Greg Hewgill (CC BY-SA 4.0)

  • Why did you leave your last job?Behavioural

    The employer may ask you questions about leaving your last job.

    If you've been out of work for a long time, explain why. Talk about the positive things you've done while away from work. For example, networking, retraining, volunteering or keeping fit.

    If you:

    • left by choice: be positive about why you want a new job and describe why their company suits you better
    • got made redundant: explain the situation, be positive and describe how you've responded since
    • were fired for misconduct or poor performance: explain why your standards dropped, what you've learned and how you've improved since the experience

    From National Careers Service: interview advice (Open Government Licence v3.0)

More jobs like this

Remote C++ and systems jobs (11)